Date formatting

Format codes may be used when constructing date formats. Only codes defined by the table below are supported.

Examples

Format Example
YYYY-MM-DD hh:mm:ss 2017-05-25 16:45:30
DD/MM/YYYY hh:mm:ss 25/05/2017 16:45:30
MM/DD/YY h:mm AM/PM 05/25/17  4:45 PM
To display Use
Months as 1–12 M
Months as 01–12 MM
Months as Jan–Dec MMM
Months as January–December MMMM
Days as 1–31 D
Days as 01–31 DD
Days as Sun–Sat DDD
Days as Sunday–Saturday DDDD
Years as 00–99 YY
Years as 1900–9999 YYYY
Hours as 0–23 h
Hours as 00–23 hh
Minutes as 0–59 m
Minutes as 00–59 mm
Seconds as 0–59 s
Seconds as 00–59 ss
Time AM or PM AM/PM