The dates are parsed accordingly to a format which can be defined using the following tokens:
Token | Example | Description |
---|---|---|
YYYY | 2018 | 2 or 4 digit year |
YY | 18 | 2 digit year |
Y | 1 | year with any number of digits |
Q | 2 | quarter of year |
M / MM | 10 | month |
MMM / MMMM | Jan / December | month name |
D / DD | 21 | day of month |
Do | 5th | day |
DDD / DDDD | 234 | day of year |
H / HH | 18 | hours (24 hour time) |
h / hh | 5 | hours (12 hour time) |
a / A / p | AM | AM or PM |
m / mm | 34 | minutes |
s / ss | 45 | seconds |
S / SS / SSS | 778 | fractional seconds |
Z / ZZ | +12:00 | offset from UTC (in +-HH:mm or +-HH mm or Z) |
Examples:
Text | Format |
---|---|
12/01/2018 14:55 | DD/MM/YYYY HH:mm |
Jan-2nd-2018 08:30 AM | MMM-Do-YYYY hh:mm a |