DelphiBasics
Time
Function
Gives the current time SysUtils unit
 function Time : TDateTime;
Description
The Time function returns the current time in the local time zone.
 
Because the return value is a TDateTime type, the date component is set to zero (30/12/1899).
Notes
Warning : the date value is one day short of the last day of the 19th century. Exactly why is unclear.
Related commands
Date Gives the current date
Now Gives the current date and time
Tomorrow Gives the date tomorrow
Yesterday Gives the date yesterday
 Author links

 Buy Website Traffic at
 Buywebsitetrafficexperts.com

 Buy Proxies at
 Buyproxies.io
 
 Download this web site as a Windows program.




 
Example code : Show the current 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 Time 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 := Time;
  ShowMessage('today has date = '+DateToStr(today));
  ShowMessage('today has time = '+TimeToStr(today));
end;
 
end.
Hide full unit code
   today has date = 30/12/1899
   today has time = 13:37:25
 
Delphi Programming Neil Moffatt 2002 - 2017. All rights reserved.  |  Home Page