Delphi clock

[ DelphiLand FAQ ]

Posted by max on July 21, 2004 at 23:50:00:

how would I have this clock tick and convert to time. It ticks in seconds and I want it on 60 to change to 1:00 and on 120 seconds change to 2:00 etc. I can't figure it out.

procedure TForm1.Timer1Timer(Sender: TObject);
  Seconds: integer;
  DateTimeNow: TDateTime;
  DateTimeNow := Now; // get current date + time
  // Calculate time in seconds since Button1 was clicked
  Seconds := Round((DateTimeNow - DateTimeStart)*24*60*60);
  Label2.Caption := IntToStr(Seconds);

Related Articles and Replies

[ DelphiLand FAQ ]