Date and Time Format Elements
A date format is created from the following date format elements.
|
Format Code |
Meaning |
Example |
|
0 |
Format element (causes a time element h, m, or s, to be returned with a leading 0). |
|
|
s |
Second |
|
|
1 |
Display fractional seconds to 1 decimal place. |
|
|
2 |
Display fractional seconds to 2 decimal places. |
|
|
3 |
Display fractional seconds to 3 decimal places. |
|
|
m |
Minute |
|
|
h |
Hour |
|
|
am |
12 hour clock with "a" or "p" suffix |
|
|
A |
12 hour clock with "A" or "P" suffix |
|
|
AM |
12 hour clock with "AM" or "PM" suffix |
|
|
d |
day (one digit) |
3 |
|
dd |
day spelled out (two digits, 0 pad) |
03, 15 |
|
x |
day with "st", "rd", "th" etc (e.g. 1st, 2nd, 23rd) |
1st, 2nd, 23rd |
|
X |
day spelled out |
First, Second, Twenty Third |
|
W |
weekday (three character, upper case) |
SUN, MON |
|
w |
weekday (three character, lower case) |
sun, mon |
|
WEEKDAY |
weekday (full name, upper case) |
SUNDAY, MONDAY |
|
weekday |
weekday (full name, lower case) |
sunday, monday |
|
Weekday |
weekday (full name, proper case) |
Sunday, Monday |
|
M |
month (one digit) |
1 |
|
MM |
month (two digits, zero pad) |
01, 10 |
|
MON |
month (three character name, upper case) |
JAN, FEB |
|
mon |
month (three character name, lower case) |
jan, feb |
|
Mon |
month (three character name, proper case) |
Jan, Feb |
|
MONTH |
month (full name, upper case) |
JANUARY, FEBRUARY |
|
month |
month (full name, lower case) |
january, february |
|
Month |
month (full name, proper case) e.g. January, February |
|
|
y |
year (two digits) |
99, 03 |
|
yy |
year (two digits) |
99, 03 |
|
yyyy |
year (four digits) |
1999, 2003 |
See Also