strftime to Go time.Format Layout Converter
Paste an strftime() format to get the equivalent Go reference-time layout string ("Mon Jan 2 15:04:05 MST 2006"-style).
Requires review Works only under specific conditions — read the caveats before relying on it.
- strftime
%Y-%m-%d %H:%M:%S- Go time.Format layout
2006-01-02 15:04:05
Main limitation: Go has no format "language" at all — every layout is literally the reference date Mon Jan 2 15:04:05 MST 2006, and Go matches substrings of your layout string against that exact reference. This converter maps each strftime directive to its corresponding reference-time substring (e.g. `%Y` → `2006`).
How it differs
- Go has no format "language" at all — every layout is literally the reference date Mon Jan 2 15:04:05 MST 2006, and Go matches substrings of your layout string against that exact reference. This converter maps each strftime directive to its corresponding reference-time substring (e.g.
%Y→2006). - Because Go's layout has no escape syntax, literal text that happens to contain a reference substring (like a literal "1" or "2") will be misinterpreted by Go itself — this is a real limitation of the target language, not something this engine can fix.
- strftime's
%Z(full timezone name, e.g. "America/New_York") has no Go layout equivalent — Go's layout only supports the shortMST-style abbreviation via the literalMSTsubstring.
Examples
Standard timestamp
| strftime | %Y-%m-%d %H:%M:%S |
|---|---|
| Go time.Format layout | 2006-01-02 15:04:05 |
Every directive maps cleanly onto a piece of the Go reference date.
Timezone name (partial conversion)
| strftime | %a %b %d %H:%M:%S %Z %Y |
|---|---|
| Go time.Format layout | Mon Jan 02 15:04:05 2006 |
`%Z` (full timezone name) has no Go layout substring and is dropped with a warning — use the literal `MST` abbreviation token instead if a short zone name is acceptable.
Edge cases
Edge case
strftime has no non-padded 24-hour hour directive, and Go's layout has no non-padded 24-hour token either (only the padded 15) — this pairing happens to align exactly.
Edge case
%a %b %d %H:%M:%S %Z %Y drops the %Z timezone name (no Go layout substring exists for it) — use the literal MST substring for the abbreviation instead, and expect a warning here.
References
- Python docs — strftime() and strptime() format codes (v3.x) — checked 2026-07-29
- Go docs — package time (reference-time layout) — checked 2026-07-29
Last verified 2026-07-29.