FormatDateTime formats a value of type TDateTime.
function FormatDateTime(const Format: string;
DateTime: TDateTime): string;
FormatDateTime formats a value of type TDateTime (DateTime). The format specified with Format is used. An overview of the possibilities of format can be found here.
var S : String; d : TDateTime; begin d:=StrToDateTime('25.10.2001 15:35:08'); S:=FormatDateTime('dddd, dd.mmmm yyyy'+
' Time: hh:mm',d); ShowMessage(s); end;
Rules to understand the script can be found here.
The date variable d is assigned the date '25.10.2001 15:35:08' via the conversion function StrToDateTime. Then the date variable is formatted and assigned to the string S via FormatDateTime.
In the format mask, the day of the week is the first thing called up by dddd. The fixed text is placed in double quotation marks. The month name is retrieved via mmmm. Since the function line in this example would have been too long, we split the format text into two parts and concatenated it with a +. Of course, the format text would also work as one line:
'dddd, dd.mmmm yyyy Time: hh:mm'
ShowMessage shows: Thursday, 25. October 2001 Time: 15:35