These expressions may be used for the time.
Expression |
Output |
h |
the hour without a leading zero (0 to 23 or 1 to 12 if AM/PM display) |
hh | the hour with a leading zero (00 to 23 or 01 to 12 if AM/PM display) |
H | the hour without a leading zero (0 to 23, even with AM/PM display) |
HH | the hour with a leading zero (00 to 23, even with AM/PM display) |
m | the minute without a leading zero (0 to 59)) |
mm | the minute with a leading zero (00 to 59) |
s | the whole second without a leading zero (0 to 59) |
ss | the whole second with a leading zero where applicable (00 to 59) |
z | the fractional part of the second, to go after a decimal point, without trailing zeroes (0 to 999). Thus "s.z" reports the seconds to full available (millisecond) precision without trailing zeroes. |
zzz | the fractional part of the second, to millisecond precision, including trailing zeroes where applicable (000 to 999). |
AP or A | use AM/PM display. A/AP will be replaced by either "AM" or "PM". |
ap or a | use am/pm display. a/ap will be replaced by either "am" or "pm". |
t | the timezone (for example "CEST") |
All other input characters will be ignored. Any sequence of characters that are enclosed in single quotes will be treated as text and not be used as an expression. Two consecutive single quotes ("''") are replaced by a singlequote in the output. Formats without separators (e.g. "HHmm") are currently not supported.
Example format strings (assumed that the date time is 21 May 2001 14:13:09.120):
Format | Result |
dd.MM.yyyy | 21.05.2001 |
ddd MMMM d yy | Tue May 21 01 |
hh:mm:ss.zzz | 14:13:09.120 |
hh:mm:ss.z | 14:13:09.12 |
h:m:s ap | 2:13:9 pm |