FormatDateTime (Delphi)

From RAD Studio Code Examples
Jump to: navigation, search

Language:

Description

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

Code

procedure TForm1.Button1Click(Sender: TObject);
var S : string;
begin
  S := SysUtils.FormatDateTime(
    '"The meeting is on " dddd, mmmm d, yyyy, " at " hh:mm AM/PM', IncHour(Now(), 3));
  Label1.Caption := S;
end;

Uses

Personal tools