DelphiBasics
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
NowGives the current date and time
TimeGives the current time
TomorrowGives the date tomorrow
YesterdayGives the date yesterday
 Download this web site as a Windows program.




 
Example code : Show the current date
begin
  ShowMessage('Yesterday = '+DateToStr(Yesterday));
  ShowMessage('Today     = '+DateToStr(Date));
  ShowMessage('Tomorrow  = '+DateToStr(Tomorrow));

  ShowMessage('Today''s time = '+TimeToStr(Date));
end;
Show full unit code
  Yesterday = 28/10/2002
  Today = 29/10/2002
  Tomorrow = 30/10/2002
  Today's time = 00:00:00
 
Delphi Programming © Neil Moffatt . All rights reserved.  |  Home Page