Here is the date in the frontmatter (generated using hugo new
)
date: 2020-04-09T15:46:08-06:00
Here is the dateFormat I’m attempting to use:
{{ .PublishDate.Format "January 1, 2000" }}
And the result is: April 9, 9000
I’ve also tried
{{ dateFormat "January 2, 2020" .PublishDate }}
and the result is: April 9, 9090
Hi there,
The date used in dateFormat
is not a random one. It is a specific point in time: https://gohugo.io/functions/format/#gos-layout-string
You will want to use "January 2, 2006"
.
2 Likes
Good lord, I was on that page and it didn’t sink in. Explains why I couldn’t find any other discussion on it, no one else made the same mistake.
maiki
4
Nah, you aren’t the only one; its just hard to know to search, “golang date format losing my mind”.
1 Like
system
Closed
5
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.