PHP date() to Java DateTimeFormatter.
23 of 24 fields map cleanly; 1 has no Java DateTimeFormatter token.
Java DateTimeFormatter
uuuuuuuu-MMMMMM-dddd HHHH:MMMM
Reference · Mon, Jan 2 2006, 3:04:05 PM MST
06060606-JanJan-0202 1515:0101
06060606-JanJan-0202 1515:0101
Right now, your zone
…
Both sides render the same instant — the translation is faithful.
| PHP date() | Java DateTimeFormatter | Field | Example |
|---|---|---|---|
| Y | uuuu | Four-digit year | 2006 |
| y | uu | Two-digit year | 06 |
| n | M | Month number | 1 |
| m | MM | Month number, padded | 01 |
| M | MMM | Month name, abbreviated | Jan |
| F | MMMM | Month name, full | January |
| j | d | Day of month | 2 |
| d | dd | Day of month, padded | 02 |
| D | EEE | Weekday, abbreviated | Mon |
| l | EEEE | Weekday, full | Monday |
| W | w | Week of year | 1 |
| o | YYYY | ISO week-based year | 2006 |
| G | H | Hour, 24-hour clock | 15 |
| H | HH | Hour, 24-hour clock, padded | 15 |
| g | h | Hour, 12-hour clock | 3 |
| h | hh | Hour, 12-hour clock, padded | 03 |
| A | a | AM/PM marker | PM |
| i | mm | Minute, padded | 04 |
| s | ss | Second, padded | 05 |
| v | SSS | Fractional seconds | 000 |
| O | Z | UTC offset, basic | -0700 |
| P | xxx | UTC offset, extended | -07:00 |
| T | z | Time-zone name, short | MST |
| U | no token | Unix timestamp | 1136239445 |