Selasa, 21 April 2020

TIMEZONE-postgres

Get current zone
To see the current time zone for a session, try either of the following statements. Technically we are calling the SHOW command to display a run-time parameter.

SHOW timezone ;
…or…

SHOW time zone ;
US/Pacific

Time Zone Name
You can specify a proper time zone name. Most of these are continent/region.

SET TIME ZONE 'Africa/Casablanca';
…or…

SET TIME ZONE 'America/Montreal';

Standard SQL Command
Alternatively, you can use the SQL command defined by the SQL spec: SET TIME ZONE. In this syntax a pair of words TIME ZONE replace "timezone" (actual SQL command versus parameter name), and there is no "TO".

SET TIME ZONE 'UTC';


Choose a timezone from:

SELECT * FROM pg_timezone_names;
And set as below given example:

ALTER DATABASE postgres SET timezone TO 'Europe/Berlin';


https://stackoverflow.com/questions/6663765/postgres-default-timezone

Tidak ada komentar:

Posting Komentar