postgresql - how to extract a list of past and known future offset changes for a timezone -


postgresql rather @ handling timezones, using classic tzdata database.

the server can convert past , future timestamps between different timezones, following rules in tzdata (offsets, dst changes, ..)

is there simple , efficient way, given timezone , given date range, extract timestamps within range when timezone modification event occured ?

the result should more or less contain equivalent of output of zdump linux command.

zdump -v /usr/share/zoneinfo/america/los_angeles | grep 2017  sun mar 12 09:59:59 2017 utc = sun mar 12 01:59:59 2017 pst isdst=0 gmtoff=-28800 sun mar 12 10:00:00 2017 utc = sun mar 12 03:00:00 2017 pdt isdst=1 gmtoff=-25200 sun nov  5 08:59:59 2017 utc = sun nov  5 01:59:59 2017 pdt isdst=1 gmtoff=-25200 sun nov  5 09:00:00 2017 utc = sun nov  5 01:00:00 2017 pst isdst=0 gmtoff=-28800 

select d::date (     select         d @ time zone 'america/los_angeles' la,         lead(d @ time zone 'america/los_angeles') on (order d) la_,         d      generate_series (         '2017-01-01'::timestamp,         '2017-12-31', '1 day'     ) gs (d) ) s la::time <> la_::time;      d       ------------  2017-03-12  2017-11-05 

Comments

Popular posts from this blog

javascript - Create a stacked percentage column -

Optimising Firebase database by automatically overwriting data -

javascript - Angular UI-Grid customTemplate directive causing rows to load slowly/? -