RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
SysUtils.Date Function

Returns the current date.

Pascal
function Date: TDateTime;
C++
TDateTime Date();

SysUtils

Use Date to obtain the current local date as a TDateTime value. The time portion of the value is 0 (midnight).  

C++ Examples: 

 

/*
This example uses a label and a button on a form. When the
user clicks the button, the current date is displayed in the
caption of the label:
*/
void __fastcall TForm1::Button1Click(TObject *Sender)
{
  Label1->Caption = DateToStr(Date());
}

 

Delphi Examples: 

{
This example uses a label and a button on a form. When the
user clicks the button, the current date is displayed in the
caption of the label:
} 
procedure TForm1.Button1Click(Sender: TObject);
begin
  Label1.Caption := 'Today is  ' + SysUtils.DateToStr(Date);
end;

 

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!