Re: Startup parameters timezone conversion

From: Dave Cramer <davecramer(at)postgres(dot)rocks>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, Thomas Kellerer <shammat(at)gmx(dot)net>, "pgsql-jdbc(at)lists(dot)postgresql(dot)org" <pgsql-jdbc(at)lists(dot)postgresql(dot)org>
Subject: Re: Startup parameters timezone conversion
Date: 2022-01-19 15:20:29
Message-ID: CADK3HH+1C5AXDNMbwx+TdYtFREOa8qVqKC3-pydwKW0WpocX0w@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

On Wed, 19 Jan 2022 at 10:17, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> "David G. Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> writes:
> > Indeed I presume it is. I wonder whether a carefully chosen timezone
> > specification on the server would cause this to break since the server
> can
> > be made to report the offset using either convention and so at least for
> > some timezone specifications the flipping of the sign would not be
> required…
>
> AFAIK, "reporting the offset" is always done with the ISO convention.
> It's only when trying to interpret a time zone specification that
> we consider the POSIX convention (and that's mostly because the
> underlying tzdb code does so). This does lead to fun stuff like
>
> postgres=# set timezone = 'GMT+2'; -- read as POSIX zone spec
> SET
> postgres=# select now();
> now
> -------------------------------
> 2022-01-19 13:03:36.000152-02 -- report as ISO
> (1 row)
>
> postgres=# set timezone = '+2'; -- read as numeric ISO offset
> SET
> postgres=# select now();
> now
> -------------------------------
> 2022-01-19 17:03:41.722767+02 -- report as ISO
> (1 row)
>
> IMO, all these cases are best-avoided legacy conventions.
> In practice you should set the timezone using the tzdb zone name
> for where you live, e.g. America/New_York.
>
> regards, tom lane
>

Thanks Tom

We don't really deal with +2 without GMT in java so this isn't an issue.
The code really only switches POSIX to ISO

I'll add a comment to the code.

Man I love API's

Dave

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Dave Cramer 2022-01-19 16:34:43 [pgjdbc/pgjdbc] 938598: docs: Document timezone reversal from POSIX to ISO...
Previous Message Dave Cramer 2022-01-19 15:08:45 Re: Startup parameters timezone conversion