Changing timezone of timestamp to an arbitrary timezone

As I understand it, currently a timestamp can be displayed with one of three timezones:

  • The original timezone of timestamp in config file or front matter (for this I include the 0.87.0 timezone)
  • Date.Local
  • Date.UTC

If I want posts (some with UTC timestamps, some with EST) displayed in EST, is there currently a way to do that for a Netlify site (which IIRC uses PST as .Local)?

EDIT: If I’m not being clear, I can create an example.


title = "Post 1"
date = 2021-08-19T10:00:00-05:00  # 2021-08-19T11:00:00 in America/New_York
draft = false


title = "Post 2"
date = 2021-08-19T09:00:00-00:00  # 2021-08-19T05:00:00-00:00 in America/New_York
draft = false


{{ define "main" }}
  <h1>{{ .Title }}</h1>
  <p>{{ .Date.Local }}</p>
  {{ .Content }}
{{ end }}


TZ="America/New_York" hugo


1 Like

Thank you! I would never have thought to check for that option on Netlify, even though I use environment variables for other things with them.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.