PostgreSQL – Set and Get Timezone

There is a timezone configuration on PostgreSQL server. If you want to change the default globally, you can edit the postgresql.conf. On Ubuntu, it is located at

  • /etc/postgresql/<version>/main/postgresql.conf
# - Locale and Formatting -

datestyle = 'iso, mdy'
#intervalstyle = 'postgres'
#timezone = 'Hongkong'
timezone = 'UTC'


We could also tweak the timezone only in your current PostgreSQL session.

1. Get the current timezone.

SELECT current_setting('TIMEZONE');


2. Set the timezone to Hong Kong.

set timezone='Asia/Hong_Kong';


Here is the timezone list on Wikipedia.


Done =)



One thought on “PostgreSQL – Set and Get Timezone”

  1. Cambiar la zona horaria a PostgreSQL (timezone)

    pgAdmin III

    Menu: Tools
    > Server Configuration >> postgresql.conf
    Setting name: double click on “timezone” & “log_timezone”
    Value: America/Santo_Domingo
    Click on [OK]
    Click on [Disc button] to Save changes.
    Click on [Yes] to Apply changes.
    Click on [Play button] to Reload Server to apply configuration changes.
    Click on [Yes] to Confirm.

    Reference link:

    SHOW timezone;
    SELECT now();



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.