Understanding Date/Time Formats

Date and time may be represented by a wide variety of tokens. We provide here a quick reference, adapted from Moment.js interface documentation.

Tokens for Date and Time Representation, with Examples
TokenInputExampleDescription
YYYYY20144- or 2-digit year
YY142-digit year
Y-25

Year with any number of digits and a sign.

Used for years that are not in 4-digit form, and for years Before the Common Era.

QQ1..4Quarter of year. Sets the month to the first month in quarter.
MM MM1..12Month number
 MMM MMMMJan..DecemberMonth name in locale set by moment.locale()
D and dD DD1..31Day of month
 Do1st..31stDay of month with ordinal
 DDD DDDD1..365Day of year
 ddd ddddMon...SundayDay name in locale set by moment.locale()
X and xX1410715640.579Unix timestamp
x1410715640579Unix ms timestamp
G and gGGGG2014ISO 4-digit week year
GG14ISO 2-digit week year
gggg2014Locale 4-digit week year
gg14Locale 2-digit week year
W and wW WW1..53ISO week of year
 w ww1..53Locale week of year
E and eE1..7ISO day of week
 e0..6Locale day of week
H and hH HH0..2324-hour time
 h hh1..1212-hour time used with a and A
A and aa Aam pm

Post- or ante-meridian.

Note that one character a or p are also valid.

mm mm0..59Minutes
s and Ss ss0..59Seconds
 S SS SSS0.999Fractional seconds
ZZ ZZ+12:00Offset from UTC, as +-HH:mm, +-HHmm, or Z.