| General
structure |
"[string] |
specifiers | [string]"
Format specifiers are to be placed in vertical bars (|). Leading and
trailing texts can be attached as an option. |
| |
|
|
| Year specifiers |
YY |
year without century |
| |
YYYY |
year with 4 digits |
| |
|
|
| Quarter specifier |
Q |
quarter of year (1..4) |
| |
Qx |
quarter, English ordinal suffix, not localized |
| |
QX |
quarter, English ordinal suffix,
not local., uppercase |
| |
|
|
| Month specifiers |
M |
month of year (1..12) |
| |
MM |
month of year with leading 0 (01..12) |
| |
Mo |
1st letter of localized month name,
uppercase |
| |
Mon |
abbr. month name, localized |
| |
MON |
abbr. month name, localized, uppercase |
| |
Month |
month name, localized |
| |
MONTH |
month name, localized, uppercase |
| |
|
|
| Week specifiers |
W |
weekday index (Sunday=1, Monday=2, ...) |
| |
WY |
week of year (1..53), The starting day is defined
by DateTimeOptions() |
| |
WWY |
week of year with leading 0 (01..53) |
| |
WD1 |
1st letter of localized weekday name, uppercase |
| |
Wd2 |
2-letter abbr. of localized weekday name |
| |
WD2 |
2-letter abbr. of localized weekday name, uppercase |
| |
Wd3 |
abbr. weekday name, localized |
| |
WD3 |
abbr. weekday name, localized, uppercase |
| |
Weekday |
weekday name, localized |
| |
WEEKDAY |
weekday name, localized, uppercase |
| |
|
|
| Day specifiers |
D |
day of month (1..31) |
| |
DD |
day of month with leading 0 (01..31) |
| |
DY |
day of year (1..366) |
| |
DDY |
day of year with leading 0 (001..366) |
| |
Dx |
English ordinal suffix, not localized |
| |
DX |
English ordinal suffix, not localized, uppercase |
| |
|
|
| Time specifiers |
h |
hour in 24-hour format (0..23) |
| |
hh |
hour in 24-hour format with leading 0 (00..23) |
| |
h12 |
hour in 12-hour format (1..12) |
| |
hh12 |
hour in 12-hour format with leading 0 (01..12) |
| |
m |
minute (0..59) |
| |
mm |
minute with leading 0 (00..59) |
| |
s |
second (0..59) |
| |
ss |
second with leading 0 (00..59) |
| |
ampm |
am or pm (in combination with h12 or hh12) |
| |
AMPM |
AM or PM (in combination with h12 or hh12) |
| |
|
|
| Examples |
|
|
| 7/31/2009 |
"|M/D/YY|" |
7/31/09 |
| |
"|D.M.YYYY|" |
31.7.2009 |
| |
"|YYYYMMDD|" |
20090731 |
| 1:58:04 |
"|h:mm:ss|" |
1:58:04 |
| |
"|hh:mm|" |
01:58 |
| |
"Time: |h:mm:ss|" |
Time: 1:58:04 |
| 14:05:32 |
"|h12:mm ampm|" |
2:05 pm |