Change RDS PostgreSQL time zone
This topic describes how to view supported time zones and change the time zone for an RDS PostgreSQL instance using SQL in Data Management (DMS).
Prerequisites
Before you begin, ensure that you have:
-
An ApsaraDB RDS for PostgreSQL instance
-
Access to DMS for the instance
Change the time zone
-
Log on to the ApsaraDB RDS for PostgreSQL instance by using DMS.
-
In the top navigation bar, choose SQL Operations > SQL Window.
-
View the supported time zones.
SELECT * FROM pg_timezone_names;Time zone names follow the
Region/Cityformat, for example,America/New_YorkorAsia/Shanghai. To find a specific time zone by keyword, use a case-insensitive search:SELECT * FROM pg_timezone_names WHERE name ILIKE '%new_york%'; -
Set the time zone for all roles.
ALTER ROLE ALL SET timezone='<time-zone-name>';Replace
<time-zone-name>with a name from thepg_timezone_namesview. For example:ALTER ROLE ALL SET timezone='UTC'; -
Verify that the time zone has been updated.
SELECT * FROM pg_db_role_setting;Confirm that the
setconfigcolumn shows the expected time zone value.