Re: Converting to UTC multiple times converts back to local time zone - Mailing list pgsql-bugs

From Tom Lane
Subject Re: Converting to UTC multiple times converts back to local time zone
Date
Msg-id 22011.1529974341@sss.pgh.pa.us
Whole thread Raw
In response to Re: Converting to UTC multiple times converts back to local time zone  (Gary Bernhardt <gary.bernhardt@gmail.com>)
List pgsql-bugs
Gary Bernhardt <gary.bernhardt@gmail.com> writes:
> ... But I would never expect the value to switch back to
> local time when I add "AT TIME ZONE 'utc'".

It might help to understand that there's a difference between what
is stored and what is displayed.  For type timestamptz, what is
stored is an absolute point in time --- effectively "in UTC", though
I'm not sure that's the best way to think about it.  But for display
purposes, it's rotated into your session TimeZone setting.  That's
why an AT TIME ZONE conversion might appear to produce no change ---
the display conversion reverses what AT TIME ZONE did.

            regards, tom lane


pgsql-bugs by date:

Previous
From: Gary Bernhardt
Date:
Subject: Re: Converting to UTC multiple times converts back to local time zone
Next
From: "David G. Johnston"
Date:
Subject: Re: Converting to UTC multiple times converts back to local time zone