其他分享
首页 > 其他分享> > Now、Date、Time、CurrentYear - 当前日期

Now、Date、Time、CurrentYear - 当前日期

作者:互联网

Now、Date、Time、CurrentYear - 当前日期

SysUtils.Now;
SysUtils.Date;
SysUtils.Time;
SysUtils.CurrentYear;

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs;

type
  TForm1 = class(TForm)
    procedure FormCreate(Sender: TObject);
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

uses DateUtils;

procedure TForm1.FormCreate(Sender: TObject);
var
  dt: TDateTime;
  d: TDate;
  t: TTime;
  y: Word;
begin
  dt := Now;
  d := Date;
  t := Time;
  y := CurrentYear;

  ShowMessage(DateTimeToStr(dt)); //2009-5-21 17:45:50
  ShowMessage(DateToStr(d));      //2009-5-21
  ShowMessage(TimeToStr(t));      //17:45:50
  ShowMessage(IntToStr(y));       //2009
end;

end.
posted on 2009-05-21 17:50  万一  阅读(3892)  评论(0)  编辑  收藏

标签:ShowMessage,SysUtils,CurrentYear,Time,Date,Now
来源: https://blog.51cto.com/u_14617575/2748122