Re: Does pg store all `timestamp with time zone` in localtime? Why?

From: Greg Robson <gregrobson(at)gmail(dot)com>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: Yann Salaün <yannsalaun1(at)gmail(dot)com>, pgsql-novice(at)postgresql(dot)org
Subject: Re: Does pg store all `timestamp with time zone` in localtime? Why?
Date: 2017-08-24 18:07:35
Message-ID: CAFjXWtzv8EWgfYcYYwKp=v=Qt_fY4eh7PxZ2XUi25BzCySTggA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Threre's a really good explanation of the data type, it's implementation,
usage and how to insert/select values:
http://phili.pe/posts/timestamps-and-time-zones-in-postgresql/

(This was one of those "this is why I love Postgres" moments!)

On 24 August 2017 at 14:00, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com> wrote:

> Yann Salaün wrote:
> > Hello,
> >
> > I was surprised to observe this behavior in psql (my time zone is GMT+2)
>
> No, it stores in UTC and converts back and forth as you store then in
> and as you read them out. It depends on the TimeZone configuration
> parameter each time. The TZ that was current when the value was stored,
> is itself NOT stored in the same column. You could add a column to
> store that TZ, if you wanted.
>
> --
> Álvaro Herrera https://www.2ndQuadrant.com/
> PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
>
>
> --
> Sent via pgsql-novice mailing list (pgsql-novice(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-novice
>

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Yann Salaün 2017-08-25 14:27:44 Re: Does pg store all `timestamp with time zone` in localtime? Why?
Previous Message kakalo 2017-08-24 17:13:12 Restore backup file