Because I’m so tired of looking it up, here’s the formatting tokens from the excellent date-fns Javascript library. This is limited to the patterns I use most frequently.
| Unit | Pattern | Results Example |
|---|---|---|
| Calendar year | y | 44, 1, 1900, 2017 |
yyyy | 0044, 0001, 1900, 2017 | |
| Month (formatting) | M | 1, 2, …, 12 |
MM | 01, 02, …, 12 | |
MMM | Jan, Feb, …, Dec | |
MMMM | January, February, …, December | |
| Day of month | d | 1, 2, …, 31 |
do | 1st, 2nd, …, 31st | |
dd | 01, 02, …, 31 | |
| Day of week (formatting) | E..EEE | Mon, Tue, Wed, …, Sun |
EEEE | Monday, Tuesday, …, Sunday | |
| AM, PM | a..aa | AM, PM |
aaa | am, pm | |
aaaa | a.m., p.m. | |
| Hour [1-12] | h | 1, 2, …, 11, 12 |
hh | 01, 02, …, 11, 12 | |
| Hour [0-23] | H | 0, 1, 2, …, 23 |
HH | 00, 01, 02, …, 23 | |
| Minute | m | 0, 1, …, 59 |
mm | 00, 01, …, 59 | |
| Second | s | 0, 1, …, 59 |
ss | 00, 01, …, 59 |
