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.

你可能感兴趣的:(Now、Date、Time、CurrentYear - 当前日期)