Configure Postgresql database server timezone

How can we change the Postgresql database server timezone from UTC? For example in postgresql.conf, we would like to use:

TimeZone = ‘America/Los_Angeles’

Note that we already set the machine timezone to America/Los_Angeles, but the database server continues to use UTC.

You could do the with sed. In your circle.yml change the postgresql.conf file and restart postgresql:

    - sudo sed -i 's/UTC/America\/Los_Angeles/' /etc/postgresql/9.4/main/postgresql.conf
    - sudo service postgresql restart

Please see this build for a full working example where the test command echo’s the current time zone from PostgreSQL.

Thank you!

1 Like