Need to convert the gmt timezone to est in postgresql considering the Day light saving time zone. If the date falls between nov to march(roughly) then it should then it should be gmt 5 hours and in the other case it should be gmt 4 hours. Do we have any predefined function or easy workaround in postgresql which should dynamically do for all the years(2022,2023 etc).
Thank you so much in Advance!!
CodePudding user response:
SELECT TIMESTAMP '2022-02-16 12:00:00'
AT TIME ZONE 'UTC'
AT TIME ZONE 'America/New_York';
timezone
═════════════════════
2022-02-16 07:00:00
(1 row)
That will respect daylight savings time shifts in the respective time zones.