Go time layout to Moment.js format.
20 of 21 fields map cleanly; 1 has no Moment.js format token.
Moment.js format
YYYY-MM-DD HH:mm
Reference · Mon, Jan 2 2006, 3:04:05 PM MST
2006-01-02 15:04
2006-01-02 15:04
Right now, your zone
…
Both sides render the same instant — the translation is faithful.
| Go time layout | Moment.js format | Field | Example |
|---|---|---|---|
| 2006 | YYYY | Four-digit year | 2006 |
| 06 | YY | Two-digit year | 06 |
| 1 | M | Month number | 1 |
| 01 | MM | Month number, padded | 01 |
| Jan | MMM | Month name, abbreviated | Jan |
| January | MMMM | Month name, full | January |
| 2 | D | Day of month | 2 |
| 02 | DD | Day of month, padded | 02 |
| 002 | DDD | Day of year | 2 |
| Mon | ddd | Weekday, abbreviated | Mon |
| Monday | dddd | Weekday, full | Monday |
| 15 | HH | Hour, 24-hour clock, padded | 15 |
| 3 | h | Hour, 12-hour clock | 3 |
| 03 | hh | Hour, 12-hour clock, padded | 03 |
| PM | A | AM/PM marker | PM |
| 04 | mm | Minute, padded | 04 |
| 05 | ss | Second, padded | 05 |
| .000 | SSS | Fractional seconds | 000 |
| -0700 | ZZ | UTC offset, basic | -0700 |
| -07:00 | Z | UTC offset, extended | -07:00 |
| MST | no token | Time-zone name, short | MST |