Setting the default time zone for a Heroku app

For Rails apps running on Heroku, by default and some_time.localtime will display in UTC. If you’d like to assign a timezone to your app, you can set the TZ config variable to a time zone (which must be in the tz database timezone format).

Personally I despise the tz database format, because it requires you to guess WHICH city is chosen to represent that time zone (for Pacific, it’s Los_Angeles, not Seattle, not San_Francisco). But that’s what Heroku uses, so to set your app to Pacific you simply run:

heroku config:add TZ="America/Los_Angeles"

The allowed options are listed on the page linked above.

1 thought on “Setting the default time zone for a Heroku app”

  1. Pingback: How to set a time zone for Heroku –

Leave a Reply

Your email address will not be published. Required fields are marked *