Re: Postgres and timezones

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Steve Rogerson <steve(dot)pg(at)yewtc(dot)demon(dot)co(dot)uk>
Cc: Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at>, "pgsql-general(at)postgresql(dot)org >> PG-General Mailing List" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Postgres and timezones
Date: 2016-01-20 13:27:27
Message-ID: CAFj8pRCx997zaOdC8e244hW1bQmL5WSk+G4Ryz7o_MXsdLVhFw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

2016-01-20 14:24 GMT+01:00 Steve Rogerson <steve(dot)pg(at)yewtc(dot)demon(dot)co(dot)uk>:

> On 20/01/16 12:53, Albe Laurenz wrote:
> > Steve Rogerson wrote:
> >> Hi, this is wrong:
> >>
> >> # select to_char('2016-01-20 00:00'::timestamp at time zone
> 'Europe/Lisbon',
> >> 'TZ');
> >> to_char
> >> ---------
> >> GMT
> >> (1 row)
> >>
> >>
> >> It should be WET, "Western European Time". Is there something I'm doing
> wrong?
> >
> > That query will always give you your local timezone.
> >
> > Here in Austria I get:
> > us
> > test=> select to_char('2016-01-20 00:00'::timestamp at time zone
> 'Asia/Yerevan', 'TZ');
> > ┌─────────┐
> > │ to_char │
> > ├─────────┤
> > │ CET │
> > └─────────┘
> > (1 row)
> >
> > Yours,
> > Laurenz Albe
> >
> That seems odd, but never mind. I'll ask the direct qn then given the
> above is
> it possible to determine the short TZ, say WET in my example.
>
> Thinking about it, probably not as I suspect that pg only stores the
> offset in
> seconds(?) from UTC, so once it has parsed "2016-.... 'Europe/Lisbon'" it
> has
> lost track of the origin TZ and in that case what else could "to_char( ...,
> 'TZ') mean then other than the current client TZ.
>

Postgres doesn't store original TZ. It does recalculation to local TZ. If
you need original TZ, you have to store it separetely.

Regards

Pavel

>
> Steve
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Eelke Klein 2016-01-20 13:40:22 Re: Postgres and timezones
Previous Message Steve Rogerson 2016-01-20 13:24:24 Re: Postgres and timezones