Rule date & time format
Date format patterns are constructed using the following tokens:
D
: the day of the month in 1 or 2 digits
DD
: the day of the month in 2 digits
Do
: the day of the month as an ordinal number (e.g. '3rd')
ddd
: the short name of the day of the week
dddd
: the full name of the day of the week
M
: the month of the year in 1 or 2 digits
MM
: the month of the year in 2 digits
MMM
: the short name of the month of the year
MMMM
: the full name of the month of the year
YY
: the year as 2 digits
YYYY
: the year as 4 digits
A
: 'AM' or 'PM'
a
: 'am' or 'pm'
H
: the hour on a 24-hour clock in 1 or 2 digits
HH
: the hour on a 24-hour clock in 2 digits
h
: the hour on a 12-hour clock in 1 or 2 digits
hh
: the hour on a 12-hour clock in 2 digits
mm
: the minutes in 2 digits
ss
: the seconds in 2 digits
S
: fractional seconds (e.g. 'SSS' denotes milliseconds)
Z
: timezone offset with colon (e.g. '+06:00')
z
: timezone offset without colon (e.g. '-0500')
X
: Unix timestamp
x
: Unix millisecond timestamp
Any other characters or punctuation in the date/time text can be specified explicitly.
Examples
- 2018-01-01 = "YYYY-MM-DD"
- Friday, November 23, 2018 = "dddd, MMMM D, YYYY"
- 2018-11-01T16:15:00-07:00 = "YYYY-MM-DDTHH:mm:ssZ"
Updated about 2 years ago