Re: Postgres and timezones

From: Vik Fearing <vik(at)2ndquadrant(dot)fr>
To: Steve Rogerson <steve(dot)pg(at)yewtc(dot)demon(dot)co(dot)uk>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
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 19:19:44
Message-ID: 569FDDD0.7020106@2ndquadrant.fr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 01/20/2016 04:24 PM, Steve Rogerson wrote:
>> Postgres doesn't store original TZ. It does recalculation to local TZ. If you
>> need original TZ, you have to store it separetely.
>>
>
> I know and that's what I'm trying to deal with. Given I know the origin TZ -
> as in Europe/Lisbon I'm trying to determine the short name so I can store it.

I would recommend against storing the abbreviation. The abbreviations
are not globally unique and don't follow daylight savings. If you want
to store the original time zone, I would use the full name.

Something like this might be relative to your interests:

INSERT INTO tbl (ts, tz)
VALUES ('2016-01-20 00:00', current_setting('TimeZone'));

This will do the right thing regardless of where the client is (unless
it's set to "localtime" and then it's useless).
--
Vik Fearing +33 6 46 75 15 36
http://2ndQuadrant.fr PostgreSQL : Expertise, Formation et Support

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David Grelaud 2016-01-20 19:45:54 Re: Why PG uses nested-loop join when no indexes are available?
Previous Message Simon Riggs 2016-01-20 19:17:11 Re: CoC [Final]