Can I set a custom timezone in the build environment?

Hi, it seems that when the build process runs the “server” that runs is set to UTC time zone. Is it possible for a given site to set a different default time zone?

Sure. It’s unix. You can do things like set a TZ environment variable in your site build environment variables :slight_smile:

So would it be like this (trying to set Central Standard Time)? I tried it via both the UI and in netlify.toml and neither seems to have an effect.

[build.environment]
  TZ = "UTC-6:00"

Any answer to my question? Is that the correct method and, if so, why might it not be working?

Hello, @brycewray, it’ll be more like TZ='America/New_York'. You can see all the available tz database timezones here: List of tz database time zones - Wikipedia.

2 Likes

Thanks! Was taking you literally about Unix so was following various online advice about doing it from the usual CLI. :grinning: Will give your tip a try when I’m back home.

Cool. Let me know how it goes.

1 Like

Appears to have worked very well. Thanks again!

1 Like

Where should I put netlify.toml file?
Is there anyway that I can set timezone in the UI?

In the root of your project: see docs.

I don’t believe so.

1 Like

I’m not certain what I’m doing wrong. I have set a TZ in my [build.environment] and it doesn’t seem to be working.

[build.environment]
TZ='America/Chicago'

Which site/deploy is this about?