Java DateTimeFormatter to Python strftime() Converter
Paste a java.time.format.DateTimeFormatter pattern to get the equivalent Python strftime() format.
Requires review Works only under specific conditions — read the caveats before relying on it.
- Java DateTimeFormatter
yyyy-MM-dd'T'HH:mm:ss- Python strftime()
%Y-%m-%dT%H:%M:%S
Main limitation: Java's single `d` (day without leading zero) has no strftime equivalent — standard strftime only supports zero-padded `%d`.
How it differs
- Java's single
d(day without leading zero) has no strftime equivalent — standard strftime only supports zero-padded%d. - Java's single-quote literal syntax (
'T',''for a literal quote) is unwrapped to plain text before being escaped for strftime (where only%needs escaping, as%%). - Java's
SSSSSS(6-digit fraction) maps to strftime's%f; Java'sSSS(3-digit milliseconds) has no strftime equivalent since Python's%fis always microseconds.
Examples
ISO-8601 timestamp
| Java DateTimeFormatter | yyyy-MM-dd'T'HH:mm:ss |
|---|---|
| Python strftime() | %Y-%m-%dT%H:%M:%S |
The quoted literal `'T'` becomes plain `T` text in the strftime output.
Non-padded day (partial conversion)
| Java DateTimeFormatter | EEEE, MMMM d, yyyy |
|---|---|
| Python strftime() | %A, %B , %Y |
Java's `d` (day without leading zero) has no strftime equivalent and is dropped with a warning, leaving the day number missing from the output.
Edge cases
Edge case
EEEE, MMMM d, yyyy loses its day number entirely when converted, because Java's non-padded d has no strftime counterpart — the output reads "Monday, July , 2026" and a warning flags the gap.
Edge case
Java's era (G), nano-of-second (n/N), and locale-dependent weekday (e/c) patterns are all left unmapped rather than approximated.
References
- Java SE docs — DateTimeFormatter (v21) — checked 2026-07-29
- Python docs — strftime() and strptime() format codes (v3.x) — checked 2026-07-29
Last verified 2026-07-29.