Re: Startup parameters timezone conversion

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Leonid Vygovskiy <Leonid(dot)Vygovskiy(at)gmail(dot)com>
Cc: pgsql-jdbc(at)lists(dot)postgresql(dot)org
Subject: Re: Startup parameters timezone conversion
Date: 2022-01-19 14:54:12
Message-ID: 504179.1642604052@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Leonid Vygovskiy <Leonid(dot)Vygovskiy(at)gmail(dot)com> writes:
> I study how to work with the timezone in JDBC driver and found the code
> which I don't understand.
> This is implementation of the method
> ConnectionFactoryImpl.createPostgresTimeZone() which has the comment:"
> Convert Java time zone to postgres time zone. All others stay the same
> except that GMT+n changes to GMT-nn and vise versa."
> I'm confused with that changing. Can anybody talk about the reasons and
> motives of this behavior?

I'm guessing that Java thinks the time zone name "GMT+2" means 2 hours
east of Greenwich (ISO-8601 sign convention). Postgres thinks it means
2 hours west of Greenwich (POSIX sign convention). See

https://www.postgresql.org/docs/current/datatype-datetime.html#DATATYPE-TIMEZONES

https://www.postgresql.org/docs/current/datetime-posix-timezone-specs.html

The great thing about standards is there are so many to choose from ;-)

regards, tom lane

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Tom Lane 2022-01-19 15:07:59 Re: Startup parameters timezone conversion
Previous Message David G. Johnston 2022-01-19 14:53:17 Re: Startup parameters timezone conversion