Topic: Date on form

Hello everyone, I would like to know how to display the system time in a TextBox without going through DateTimePicker, I would like it to remain displayed permanently. THANK YOU

Re: Date on form

sdpc62 wrote:

Hello everyone, I would like to know how to display the system time in a TextBox without going through DateTimePicker, I would like it to remain displayed permanently. THANK YOU

var
Time: TTimer;

procedure Form1_OnShow (Sender: TObject; Action: string);
begin
  Time := TTImer.Create(Form1);
  Time.Enabled := True;
  Time.Interval := 100;
  Time.OnTimer := @NowTime;
end;

procedure NowTime;
begin
  Form1.Label2.Caption := FormatDateTime('HH:MM:SS', Now);
end;
Post's attachments

Attachment icon test.rar 2.24 kb, 92 downloads since 2023-07-03 

Re: Date on form

Thanks Vladimir, that's exactly what I wanted.