Go time layout to Java DateTimeFormatter.
Every Go time layout field maps cleanly — the table below is the whole story.
Java DateTimeFormatter
uuuu-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 | Java DateTimeFormatter | Field | Example |
|---|---|---|---|
| 2006 | uuuu | Four-digit year | 2006 |
| 06 | uu | 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 | D | Day of year | 2 |
| Mon | EEE | Weekday, abbreviated | Mon |
| Monday | EEEE | 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 | Z | UTC offset, basic | -0700 |
| -07:00 | xxx | UTC offset, extended | -07:00 |
| MST | z | Time-zone name, short | MST |