I am trying to wrap my head around Postgresql time zones and I cannot figure it out. EST is "Eastern Standard Time" in America and usually UTC-5 .
Example 1: basic test
select '08/31/2011 12:00 pm EST'::timestamptz at time zone 'EST'; timezone
Example 2: Offset is +5
select '08/31/2011 12:00 pm EST' at time zone '+5'; timezone
Example 3: Offset is -5
select '08/31/2011 12:00 pm EST' at time zone '-5'; timezone
Clearly, the opposite is true. EST again ... should be UTC-5 . Now I looked through the documentation, and this explains that all this is "POSIX", which is in the opposite direction . (Positive offset west of GMT, while negative offset east of GMT).
However, how do I get around this? At the application level, I can always invert the + sign to a sign, but that seems a bit messy for me IMO. So my final question.
At the database level (Postgres), is there a way to use the "At Time Zone" syntax so that GMT-5 matches EST? Or do I just need to invert everything at the application level?
source share