Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
demonstrating how psql displays dates with timezone set to different values
jeff=> set timezone to +0;
SET
jeff=> select * from tztest;
id | time
----+-------------------------------
1 | 2016-08-23 20:21:06.96913+00
2 | 2016-08-23 20:21:07.768979+00
3 | 2016-08-23 20:21:10.98475+00
4 | 2016-08-23 20:21:19.181596+00
5 | 2016-01-01 17:34:56+00
(5 rows)
jeff=> set timezone to default;
SET
jeff=> select * from tztest;
id | time
----+-------------------------------
1 | 2016-08-23 16:21:06.96913-04
2 | 2016-08-23 16:21:07.768979-04
3 | 2016-08-23 16:21:10.98475-04
4 | 2016-08-23 16:21:19.181596-04
5 | 2016-01-01 12:34:56-05
(5 rows)
jeff=> set timezone to 'US/Pacific';
SET
jeff=> select * from tztest;
id | time
----+-------------------------------
1 | 2016-08-23 13:21:06.96913-07
2 | 2016-08-23 13:21:07.768979-07
3 | 2016-08-23 13:21:10.98475-07
4 | 2016-08-23 13:21:19.181596-07
5 | 2016-01-01 09:34:56-08
(5 rows)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.