To view the time zones and times for a database:
postgres = # select now ();
now
------------------------------
2017-09-29 12: 54: 04.04916 + 08
(1 line record)
To view time zones:
postgres = # show time zone;
TimeZone
---------------
Asia / Shanghai
(1 line record)
To view the time zone that the database is available for selection:
postgres=# select * from pg_timezone_names;
name | abbrev | utc_offset | is_dst ----------------------------------------+--------+------------+-------- Africa/Abidjan | GMT | 00:00:00 | f
Africa/Accra | GMT | 00:00:00 | f
Africa/Addis_Ababa | EAT | 03:00:00 | f
Africa/Algiers | CET | 01:00:00 | f
Africa/Asmara | EAT | 03:00:00 | f
Africa/Asmera | EAT | 03:00:00 | f
Africa/Bamako | GMT | 00:00:00 | f
Africa/Bangui | WAT | 01:00:00 | f
Africa/Banjul | GMT | 00:00:00 | f
Africa/Bissau | GMT | 00:00:00 | f
.......................
Set the time zone:
Postgres=set time zone "Asia/Shanghai"; SET
PostgreSQL Time Zone Adjustment