Java DateTimeFormatter to PHP date() Converter

Paste a java.time.format.DateTimeFormatter pattern to get the equivalent PHP date() format string.

Token-by-token mapping

Shown one token at a time — some dialects combine two adjacent tokens (like a day number plus an ordinal suffix) into a single result above, which can differ slightly from this per-token view.

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 yyyy becomes PHP's Y, and EEEE becomes l.
  • 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 (as T does, for timezone abbreviation).
  • Java's SSSSSS (6-digit fraction) maps to PHP's u; Java's SSS (3-digit) maps to PHP's v — 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.