Last active
November 20, 2023 10:10
-
-
Save cabecada/94fc1e1354dba8920e8bc5a96a7f6b10 to your computer and use it in GitHub Desktop.
timezone lateral current time in all timezones
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
citusdb=# select * from pg_timezone_names limit 1; | |
name | abbrev | utc_offset | is_dst | |
------------+--------+------------+-------- | |
Etc/GMT-12 | +12 | 12:00:00 | f | |
(1 row) | |
citusdb=# select current_timestamp at time zone 'UTC'; | |
timezone | |
--------------------------- | |
2023-11-20 09:59:05.33791 | |
(1 row) | |
citusdb=# select name, x.t from pg_timezone_names join lateral (select current_timestamp at time zone name as t) x on true where name = 'UTC'; | |
name | t | |
------+---------------------------- | |
UTC | 2023-11-20 09:59:13.822538 | |
select name, x.t from pg_timezone_names join lateral (select make_timestamptz(2020,1,1,1,1,1,name) as t) x on true limit 5; | |
name | t | |
------------+--------------------------- | |
Etc/GMT-12 | 2019-12-31 18:31:01+05:30 | |
Etc/GMT+8 | 2020-01-01 14:31:01+05:30 | |
Etc/GMT-14 | 2019-12-31 16:31:01+05:30 | |
Etc/GMT+5 | 2020-01-01 11:31:01+05:30 | |
Etc/GMT-9 | 2019-12-31 21:31:01+05:30 | |
(5 rows) | |
(1 row) | |
citusdb=# select name, x.t from pg_timezone_names join lateral (select current_timestamp at time zone name as t) x on true limit 5; | |
name | t | |
------------+---------------------------- | |
Etc/GMT-12 | 2023-11-20 21:59:22.487003 | |
Etc/GMT+8 | 2023-11-20 01:59:22.487003 | |
Etc/GMT-14 | 2023-11-20 23:59:22.487003 | |
Etc/GMT+5 | 2023-11-20 04:59:22.487003 | |
Etc/GMT-9 | 2023-11-20 18:59:22.487003 | |
(5 rows) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment