SysUtilsTimeToStr (C++)
Description
This procedure displays the current time in the form's caption every time the Timer's OnClick event fires, based upon the Interval Property (default: 1000 = 1 second).
Code
void __fastcall TForm1::Timer1Timer(TObject *Sender)
{
TDateTime DateTime = Time(); // Store the current date and time.
String str = TimeToStr(DateTime); // Convert the time to a string.
Caption = str; // Display the time on the form's caption.
// Note: This can also be done using the following line of code:
// Caption = TimeToStr(Time());
}
Uses
- System.SysUtils.Time ( fr | de | ja )
- System.SysUtils.TimeToStr ( fr | de | ja )