How to change the Timezone setting for Heroku Postgres?

Issue

I want to change the timezone of my Heroku Postgres database.

Resolution

We highly suggest leaving your database times in UTC and modifying them at your application level. This results in your data being more ubiquitous and easier to convert when needed. Having dates in the database using a different timezone is problematic since many libraries and functions often expect dates and times in UTC, including Heroku Connect.

If you need to change the timezone, you can connect to your Heroku Postgres database with $ heroku pg:psql and running ALTER DATABASE your_database_name SET timezone = timezone_name;. However, please consider the repercussions of changing the timezone for your application.

For example: ALTER DATABASE your_database_name SET timezone = 'Brazil / East';.

You can find the name of the different timezones recognised by PostgreSQL by running SELECT * FROM pg_timezone_names; on your database.

Ask on Stack Overflow

Engage with a community of passionate experts to get the answers you need

Ask on Stack Overflow

Heroku Support

Create a support ticket and our support experts will get back to you

Contact Heroku Support