Java DateTimeFormatter to PHP date() Converter
Paste a java.time.format.DateTimeFormatter pattern to get the equivalent PHP date() format string.
Close equivalent Covers the common case, but has documented behavioral differences.
- Java DateTimeFormatter
yyyy-MM-dd'T'HH:mm:ss- PHP date()
Y-m-d\TH:i:s
Main limitation: Java's letter-repetition patterns collapse into PHP's single-character tokens — e.g. Java's `yyyy` becomes PHP's `Y`, and `EEEE` becomes `l`.
How it differs
- Java's letter-repetition patterns collapse into PHP's single-character tokens — e.g. Java's
yyyybecomes PHP'sY, andEEEEbecomesl. - Java's single-quoted literal text (
'T') is unwrapped to plain text, then re-escaped for PHP only if it collides with a PHP format character (asTdoes, for timezone abbreviation). - Java's
SSSSSS(6-digit fraction) maps to PHP'su; Java'sSSS(3-digit) maps to PHP'sv— both are supported here, matching the PHP-to-Java direction.
Examples
ISO-8601 timestamp
| Java DateTimeFormatter | yyyy-MM-dd'T'HH:mm:ss |
|---|---|
| PHP date() | Y-m-d\TH:i:s |
The quoted literal `'T'` becomes an escaped `\T` in PHP, since `T` is a PHP format character.
Long-form date
| Java DateTimeFormatter | EEEE, MMMM d, yyyy |
|---|---|
| PHP date() | l, F j, Y |
Unlike Python's strftime, PHP has a non-padded day token (`j`), so this conversion is fully exact.
Edge cases
Edge case
Java's non-padded d (day without leading zero) converts cleanly to PHP's j — unlike the Java-to-Python direction, PHP does have a non-padded day token.
Edge case
Java's locale-dependent e/c (numeric weekday) and era (G) patterns have no PHP equivalent and are dropped with a warning rather than mapped to PHP's ISO-only N.
References
- Java SE docs — DateTimeFormatter (v21) — checked 2026-07-29
- PHP Manual — date() — checked 2026-07-29
Last verified 2026-07-29.