[Overview][Constants][Types][Classes][Procedures and functions][Variables] |
Return a string representation of a TDateTimevalue with a given format.
Source position: datih.inc line 121
function FormatDateTime( |
FormatStr: String; |
DateTime: TDateTime |
):String; |
FormatDateTimeformats the date and time encoded in DateTimeaccording to the formatting given in FormatStr. The complete list of formatting characters can be found in formatchars.
On error (such as an invalid character in the formatting string), and EConvertErrorexception is raised.
|
Converts a TDateTimevalue to a string using a predefined format. |
|
|
Converts a TDateTimevalue to a date string with a predefined format. |
|
|
Convert a TDateTimetime to a string using a predefined format. |
|
|
Convert a date/time string to a TDateTimevalue. |
Program Example14; { This program demonstrates the FormatDateTime function } Uses sysutils; Var ThisMoment : TDateTime; Begin ThisMoment:=Now; Writeln ('Now : ',FormatDateTime('hh:nn',ThisMoment)); Writeln ('Now : ',FormatDateTime('DD MM YYYY',ThisMoment)); Writeln ('Now : ',FormatDateTime('c',ThisMoment)); End.