Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nACLq-0001fF-Ll for pgsql-jdbc@arkaria.postgresql.org; Wed, 19 Jan 2022 14:54:18 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nACLp-0006Q5-GN for pgsql-jdbc@arkaria.postgresql.org; Wed, 19 Jan 2022 14:54:17 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nACLp-0006Nx-95 for pgsql-jdbc@lists.postgresql.org; Wed, 19 Jan 2022 14:54:17 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nACLm-0005sO-SC for pgsql-jdbc@lists.postgresql.org; Wed, 19 Jan 2022 14:54:16 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 20JEsCXS504180; Wed, 19 Jan 2022 09:54:12 -0500 From: Tom Lane To: Leonid Vygovskiy cc: pgsql-jdbc@lists.postgresql.org Subject: Re: Startup parameters timezone conversion In-reply-to: References: Comments: In-reply-to Leonid Vygovskiy message dated "Wed, 19 Jan 2022 15:11:34 +0300" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <504178.1642604052.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Wed, 19 Jan 2022 09:54:12 -0500 Message-ID: <504179.1642604052@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Leonid Vygovskiy 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-TI= MEZONES 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