SystemTimeToDateTime (C++)
Description
The following code retrieves the current date and time using the Windows GetLocalTime API call and converts this value to a TDateTime value.
Code
TDateTime __fastcall GetCurrentDateTime()
{
  SYSTEMTIME SystemTime;
  GetLocalTime(&SystemTime);
  return SystemTimeToDateTime(SystemTime);
}
void __fastcall TForm1::Button1Click(TObject *Sender)
{
  Label1->Caption = DateTimeToStr(GetCurrentDateTime());
}
Uses
- System.SysUtils.SystemTimeToDateTime ( fr | de | ja )