Go time.Format Layout to strftime Converter
Paste a Go reference-time layout string to get the equivalent strftime() format code.
Requires review Works only under specific conditions — read the caveats before relying on it.
- Go time.Format layout
2006-01-02T15:04:05- strftime
%Y-%m-%dT%H:%M:%S
Main limitation: This converter scans the Go layout for the longest matching reference substring first (e.g. `2006` before `06`, `January` before `Jan`), exactly like the Go standard library itself does when parsing layouts.
How it differs
- This converter scans the Go layout for the longest matching reference substring first (e.g.
2006before06,JanuarybeforeJan), exactly like the Go standard library itself does when parsing layouts. - Go's non-padded day token (a bare
2) has no strftime equivalent, since strftime's%dis always zero-padded — this is one of the most common lossy conversions in this direction. - Go's
Z07:00/Z0700(ISO-8601 offset using literal "Z" for UTC) has no strftime equivalent; use plain-07:00/-0700(which map to%z-family output) if the "Z" special-case isn't required.
Examples
ISO-8601 timestamp
| Go time.Format layout | 2006-01-02T15:04:05 |
|---|---|
| strftime | %Y-%m-%dT%H:%M:%S |
Every Go reference substring here has a direct strftime directive.
Non-padded day (partial conversion)
| Go time.Format layout | Mon Jan 2 15:04:05 2006 |
|---|---|
| strftime | %a %b %H:%M:%S %Y |
Go's bare `2` (day without leading zero) has no strftime equivalent and is dropped with a warning.
Edge cases
Edge case
Mon Jan 2 15:04:05 2006 (Go's canonical reference layout) loses its day number when converted, because the bare 2 token has no strftime counterpart.
Edge case
Go has no built-in escape mechanism, so a source layout with stray literal text resembling reference substrings will already behave surprisingly in Go itself, independent of this converter.
References
- Go docs — package time (reference-time layout) — checked 2026-07-29
- Python docs — strftime() and strptime() format codes (v3.x) — checked 2026-07-29
Last verified 2026-07-29.