FormatDateTime (C++)

From RAD Studio Code Examples
Jump to: navigation, search

Description

The following example uses FormatDateTime to set the string variable S to a sentence indicating a meeting time in 3 hours. The sentence has the form "The meeting is on Wednesday, February 15, 1995 at 2:30 PM."

Code

void __fastcall TForm1::Button1Click(TObject *Sender)
{
  String S = L"The ૯આન૪ meeting is on ";
  S = S + FormatDateTime("dddd, mmmm d, yyyy ' at ' hh:mm AM/PM", IncHour(Now(), 3));
  Label1->Caption = S;
}

Uses