set timezone on Heroku servers
Set timezone on Heroku dynos. Tested on cedar stack.
heroku config:add TZ=America/Whitehorse
Set timezone on dedicated PostgreSQL server
- get list of timezones from wikipedia
- get user id
- change time zone
heroku pg:psql ALTER ROLE youruserid SET timezone = 'America/Los_Angeles'; \q
Update from heroku:
The user id will stay the same across forks and follows.
It will change if you request it to be randomly re-generated or if you get a new database and use PGBackups.
Also, there is an important caveat: the ALTER ROLE SET TIMEZONE setting does not persist in PGBackups or pg_dump or pg_restore at this time.
I would suggest having your software automatically run SET TIMEZONE at connection start-up to be the most robust approach because of that problem, but if you must, ALTER ROLE does work.