Description |
The Now function returns the current date and time in the local time zone.
The returned TDateTime type can be manipulated and displayed by many SysUtil and DateUtils routines.
|
|
Related commands |
|
|
|
Example code : Show the current date and time |
// Full Unit code. // ----------------------------------------------------------- // You must store this code in a unit called Unit1 with a form // called Form1 that has an OnCreate event called FormCreate. unit Unit1; interface uses SysUtils, // Unit containing the Now command Forms, Dialogs; type TForm1 = class(TForm) procedure FormCreate(Sender: TObject); end; var Form1: TForm1; implementation {$R *.dfm} // Include form definitions procedure TForm1.FormCreate(Sender: TObject); var
today : TDateTime;
begin
today := Now;
ShowMessage('today has date = '+DateToStr(today));
ShowMessage('today has time = '+TimeToStr(today));
end; end.
|
Hide full unit code |
today has date = 12/10/2002
today has time = 13:37:25
|
|