Configure Postgresql database server timezone


#1

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.


#2

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

test:
  pre:
    - 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.


#3

Thank you!


#4