SmartPascal
Date
Function
Gives the current date SysUtils unit
 function Date : TDateTime;
Description
The Date function returns the current date in the local time zone.
 
Because the return value is a TDateTime type, the time component is set to zero (start of day).
Related commands
Now Gives the current date and time
Time Gives the current time
Tomorrow Gives the date tomorrow
Yesterday Gives the date yesterday
 
Example code : Show the current date
// 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 Date command
  DateUtils,
  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);

begin
  ShowMessage('Yesterday = '+DateToStr(Yesterday));
  ShowMessage('Today     = '+DateToStr(Date));
  ShowMessage('Tomorrow  = '+DateToStr(Tomorrow));

  ShowMessage('Today''s time = '+TimeToStr(Date));
end;
 
end.
Hide full unit code
   Yesterday = 28/10/2002
   Today     = 29/10/2002
   Tomorrow  = 30/10/2002
   Today's time = 00:00:00