FormatDateTime

Top  Previous  Next

Prototype

 

StrOutput:=FormatDateTime (strFormat, floatDateTime)

 

Description

 

Converts date and time into a string, by using the format mask (strFormat).

 

Parameters

 

StrFormat: string can contain characters Y (Year) , M (Month) , D (Day), H (Hour), N (Minutes), S (Seconds), Z (milliseconds).

 

FloatDateTime: real numeric value, representing date and time, that has to be converted into a string.

 

Returned value

 

StrOutput: output string.

 

Notes

 

Dates and hours are considered as real numbers that represent the number days since 01/01/1980.  Thus, a date contains hour if the representing number has a fractional part, otherwise if the number is integer, it contains only a date.

 

Example

 

// Store the date and hour

DateHour:=Now;

 

// Converts the date and hour into a string

DateHourStr:=FormatDateTime('DD/MM/YYYY HH:NN:SS',DateHour);

 

// Log a message with date and hour

ApplicationLog('Date and hour:' + DateHourStr);