The following table shows the date format you can use to format a date, time, or timestamp:
Pattern | Description |
---|---|
Y,YYY | Year in 4 digits with a comma (e.g., 2,025 ) |
YYYY | Year in 4 digits (e.g., 2025 ) |
YYY | Last 3 digits of the year (e.g., 025 for 2025 ) |
YY | Last 2 digits of the year (e.g., 25 for 2025 ) |
Y | Last digit of the year (e.g., 5 for 2025 ) |
IYYY | ISO 8601 week-numbering year in 4 digits |
IYY | Last 3 digits of the ISO 8601 week-numbering year |
IY | Last 2 digits of the ISO 8601 week-numbering year |
I | Last digit of the ISO 8601 week-numbering year |
BC, bc, AD, ad | Era indicator without periods (e.g., BC , AD ) |
B.C., b.c., A.D., a.d. | Era indicator with periods (e.g., B.C. , A.D. ) |
MONTH | Full month name in uppercase (e.g., MARCH ) |
Month | Full month name with first letter capitalized (e.g., March ) |
month | Full month name in lowercase (e.g., march ) |
MON | Abbreviated month name in uppercase (e.g., MAR ) |
Mon | Abbreviated month name with first letter capitalized (e.g., Mar ) |
mon | Abbreviated month name in lowercase (e.g., mar ) |
MM | Month number (01-12) |
DAY | Full weekday name in uppercase (e.g., TUESDAY ) |
Day | Full weekday name with first letter capitalized (e.g., Tuesday ) |
day | Full weekday name in lowercase (e.g., tuesday ) |
DY | Abbreviated weekday name in uppercase (e.g., TUE ) |
Dy | Abbreviated weekday name with first letter capitalized (e.g., Tue ) |
dy | Abbreviated weekday name in lowercase (e.g., tue ) |
DDD | Day of the year (001-366) |
IDDD | Day of the ISO 8601 week-numbering year (001-366) |
DD | Day of the month (01-31) |
D | Day of the week (1 = Sunday, 7 = Saturday) |
ID | ISO 8601 day of the week (1 = Monday, 7 = Sunday) |
W | Week of the month (1-5, where the first week starts on the first day of the month) |
WW | Week number of the year (1-53, where the first week starts on the first day of the year) |
IW | ISO 8601 week number of the year (01-53, where week 1 contains the first Thursday of the year) |
CC | Century (e.g., 21 for years 2000-2099) |
J | Julian Day (integer days since November 24, 4714 BC, at noon UTC) |
RM | Month in uppercase Roman numerals (I-XII; I = January, XII = December) |
rm | Month in lowercase Roman numerals (i-xii; i = January, xii = December) |
Was this tutorial helpful ?