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 =)
Reference:
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:
https://www.postgresql.org/docs/8.1/static/datetime-keywords.html
Test:
SHOW timezone;
SELECT now();
DO25L26JN17H2137LR
LikeLike