Set timezone for your Heroku app
Heroku uses UTC by default. To change this, set your preferred timezone using the TZ Database Timezone format (http://en.wikipedia.org/wiki/List_of_tz_database_time_zones)
For example, for Pacific Time:
$ heroku config:add TZ="America/Los_Angeles"
Credit to http://blog.pardner.com/2012/08/setting-the-default-time-zone-for-a-heroku-app/
Written by Johnny Rodgers
Related protips
2 Responses
Thanks for this. I can set to my local timezone but does that mean people in a different timezones will be off? Do you know how we set it so the Date will read whatever local timezone of the user?
checkthemethod: What this setting controls is which timezone database records use when they are created and updated. If you set the TZ to Pacific Standard, as in the example above, then any dates and times you output in your app will be displayed in PST. To offset based on the timezone of the user, look into http://api.rubyonrails.org/classes/ActiveSupport/TimeWithZone.html. A useful article: http://www.elabs.se/blog/36-working-with-time-zones-in-ruby-on-rails.