Why Go Uses a Reference Time Instead of strftime Patterns

Go uses a reference time format to ensure consistent, locale-independent date formatting by using a concrete example as a template.

Go uses a reference time (Mon Jan 2 15:04:05 MST 2006) instead of strftime patterns to provide a concrete, unambiguous example of the desired format rather than a symbolic string. This design choice prevents errors caused by locale-specific differences in strftime symbols and makes the format string self-documenting. You use the reference time by replacing each component with the corresponding time field you want to display.

import "time"

t := time.Now()
fmt.Println(t.Format("2006-01-02 15:04:05 MST"))