Hugo time format
I was surprised by the way that dates get formatted on Hugo: Format returns a textual representation of the time.Time value formatted according to the layout string .
An actual example:
I wanted to change the way dates were rendered by my site’s default frontmatter template (archetypes/default.md):
date = "{{ .Date }}"
Renders the date as something like: "2026-09-14T19:14:35-07:00".
To get it to render with a yyyy-mm-dd format - excluding the time data - I updated the template to:
date = "{{ .Date | time.Format "2006-01-02" }}"
The use of "2006-01-02" seemed kind of arbitrary, but it comes from
Go’s reference time
. Go uses January 2, 2006, at 15:04:05 as the reference time. When using the Hugo time.Format method, you describe how that reference time should look.