Re: Converting to UTC multiple times converts back to local time zone

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Gary Bernhardt <gary(dot)bernhardt(at)gmail(dot)com>
Cc: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: Converting to UTC multiple times converts back to local time zone
Date: 2018-06-26 00:52:21
Message-ID: 22011.1529974341@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Gary Bernhardt <gary(dot)bernhardt(at)gmail(dot)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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message David G. Johnston 2018-06-26 00:52:47 Re: Converting to UTC multiple times converts back to local time zone
Previous Message Gary Bernhardt 2018-06-26 00:40:27 Re: Converting to UTC multiple times converts back to local time zone