随笔 - 2146  文章 - 97 评论 - 11767 trackbacks - 253

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  万一  阅读(...)  评论(...编辑  收藏