Date and Time Formats
- Last UpdatedMar 12, 2021
- 2 minute read
Date and time formatting is to convert date and time value to a human readable string using culture's specific settings.
Standard Date and Time Formats
|
Format |
Description |
Example (for en-US) |
|
d |
Short date pattern. |
M/d/yyyy 11/6/2000 |
|
"D" |
Long date pattern. |
dddd, MMMM dd, yyyy Monday, November 06, 2000 |
|
F |
Full date/time pattern. |
dddd, MMMM dd, yyyy h:mm:ss tt Monday, November 06, 2000 12:00:00 AM |
|
g |
General date/time pattern (short time). |
M/d/yyyy h:mm tt 11/6/2000 12:00 AM |
|
G |
General date/time pattern (long time). |
M/d/yyyy h:mm:ss tt 11/6/2000 12:00:00 AM |
|
M/m |
Month/day pattern. |
MMMM dd November 06 |
|
u |
Universal sortable date/time pattern. |
yyyy'-'MM'-'dd HH':'mm':'ss'Z' 2000-11-06 00:00:00Z |
|
Y/y |
Year/month pattern. |
MMMM, yyyy November, 2000 |
Custom Date and Time Formats
Create custom date and time format string using one or more custom date and time specifiers.
|
Format |
Description |
|
d |
The day of the month, from 1 through 31. |
|
dd |
The day of the month, from 01 through 31. |
|
ddd |
The abbreviated name of the day of the week. |
|
dddd |
The full name of the day of the week. |
|
f |
The tenths of a second in a date and time value. |
|
ff |
The hundredths of a second in a date and time value. |
|
fff |
The milliseconds in a date and time value. |
|
M |
The month, from 1 through 12. |
|
MM |
The month, from 01 through 12. |
|
MMM |
The abbreviated name of the month. |
|
MMMM |
The full name of the month. |
|
h |
The hour, using a 12-hour clock from 1 to 12. |
|
hh |
The hour, using a 12-hour clock from 01 to 12. |
|
H |
The hour, using a 24-hour clock from 1 to 23. |
|
HH |
The hour, using a 24-hour clock from 01 to 23. |
|
m |
The minute, from 0 through 59. |
|
mm |
The minute, from 00 through 59. |
|
s |
The second, from 0 through 59. |
|
ss |
The second, from 00 through 59. |
|
tt |
The AM/PM designator. |
|
yy |
The last two characters from year value. |
|
yyyy |
The year full value. |