Re: Re: Timestamp with vs without time zone. - Mailing list pgsql-general

From Peter J. Holzer
Subject Re: Re: Timestamp with vs without time zone.
Date
Msg-id YUmbZHqaq+NGLC1B@hjp.at
Whole thread Raw
In response to Aw: Re: Timestamp with vs without time zone.  (Karsten Hilbert <Karsten.Hilbert@gmx.net>)
Responses Re: Re: Timestamp with vs without time zone.  (Tim Uckun <timuckun@gmail.com>)
List pgsql-general
On 2021-09-21 09:39:59 +0200, Karsten Hilbert wrote:
> > It seems like it would be so much more useful if the timestamp with
> > time zone type actually stored the time zone in the record.
>
> Which one ?

To expand on that question a bit:

There are several formats to specify a time zone: By offset, by name
(several nomenclatures), etc.

For example, Karsten's mail had a timestamp of "2021-09-21 09:39:59
+0200". Thst's enough information to convert it to UTC, but not enough
for date arithmetic. For example what is
    '2021-09-21 09:39:59 +0200' + '2 months'::interval?

Should the result be '2021-11-21 09:39:59 +0200' or '2021-11-21 09:39:59
+0100'? I'm guessing that Karsten is in Germany, so it's probably the
latter. But to compute that you need to know that the timezone is
Europe/Berlin (or at least CET). Even that is not enough for dates in
the more distant future. The EU has decided to abolish DST (that should
have happened in 2020, but of course there was that little problem that
got in the way), but we don't know when that will happen and which
timezone Germany will choose. So for a date in e.g. 2025 we simply don't
know what the timezone offset will be.

        hp

--
   _  | Peter J. Holzer    | Story must make more sense than reality.
|_|_) |                    |
| |   | hjp@hjp.at         |    -- Charles Stross, "Creative writing
__/   | http://www.hjp.at/ |       challenge!"

Attachment

pgsql-general by date:

Previous
From: Karsten Hilbert
Date:
Subject: Aw: Re: Re: Timestamp with vs without time zone.
Next
From: Tim Uckun
Date:
Subject: Re: Re: Re: Timestamp with vs without time zone.