Session level timezone in Postgres

Posted
postgres

You can set timezone at session level in Postgres using SET. It allows to override the server-level timezone for a specific session.
SET timezone = 'US/Pacific';
You can use the SELECT statement to verify the current timezone by executing:
SELECT current_setting('timezone');

+-----------------+ | current_setting | |-----------------| | US/Pacific | +-----------------+

Now, the datetime columns being returned from the database will match the set timezone (US/Pacific here).