Convert the specified date/time to a string, according specified settings.
Syntax |
dateTimeToString(datetime dt, string fmt): string dateTimeToString(datetime dt, int dfmt=X_LocalDate): string |
---|---|
dt |
Date/time information |
fmt |
Format string (#1) |
dfmt |
Date format code (#2) |
Result |
Return generated string, or "" on failure |
Available format keys (#1) are the following:
Key |
Description |
---|---|
d |
the day as number without a leading zero (1-31) |
dd |
the day as number with a leading zero (01-31) |
ddd |
the abbreviated localized day name |
dddd |
the long localized day name |
M |
the month as number without a leading zero (1-12) |
MM |
the month as number with a leading zero (01-12) |
MMM |
the abbreviated localized month name |
MMMM |
the long localized month name |
yy |
the year as two digit number (00-99) |
yyyy |
the year as four digit number (1752-8000) |
h |
the hour without a leading zero (0..23 or 1..12 if AM/PM display) |
hh |
the hour with a leading zero (00..23 or 01..12 if AM/PM display) |
m |
the minute without a leading zero (0..59) |
mm |
the minute with a leading zero (00..59) |
s |
the second whithout a leading zero (0..59) |
ss |
the second whith a leading zero (00..59) |
z |
the milliseconds without leading zeroes (0..999) |
zzz |
the milliseconds with leading zeroes (000..999) |
AP |
use AM/PM display. AP will be replaced by either "AM" or "PM" |
ap |
use am/pm display. ap will be replaced by either "am" or "pm" |
Available date format code (#2) are the following:
Flag |
Description |
---|---|
X_TextDate |
Default format |
X_ISODate |
ISO 8601 extended format |
X_LocalDate |
Locale dependent format |