Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hNpti-0005UE-WA for pgsql-jdbc@arkaria.postgresql.org; Tue, 07 May 2019 02:32:03 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hNpth-0001FE-Oj for pgsql-jdbc@arkaria.postgresql.org; Tue, 07 May 2019 02:32:01 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hNpth-0001E0-EA for pgsql-jdbc@lists.postgresql.org; Tue, 07 May 2019 02:32:01 +0000 Received: from smtp88.ord1d.emailsrvr.com ([184.106.54.88]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hNptc-0005XJ-2N for pgsql-jdbc@postgresql.org; Tue, 07 May 2019 02:31:59 +0000 Received: from smtp12.relay.ord1d.emailsrvr.com (localhost [127.0.0.1]) by smtp12.relay.ord1d.emailsrvr.com (SMTP Server) with ESMTP id E1050E01C6 for ; Mon, 6 May 2019 22:31:54 -0400 (EDT) X-Auth-ID: david.wall@myeastside.com Received: by smtp12.relay.ord1d.emailsrvr.com (Authenticated sender: david.wall-AT-myeastside.com) with ESMTPSA id 85A09E01D5 for ; Mon, 6 May 2019 22:31:53 -0400 (EDT) X-Sender-Id: david.wall@myeastside.com Received: from [10.138.21.190] (50-46-124-128.evrt.wa.frontiernet.net [50.46.124.128]) (using TLSv1.2 with cipher AES128-SHA) by 0.0.0.0:465 (trex/5.7.12); Mon, 06 May 2019 22:31:54 -0400 To: pgsql-jdbc@postgresql.org From: David Wall Subject: Java 8 OffsetDateTime clarification Message-ID: Date: Mon, 6 May 2019 19:31:52 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk In the JDBC document about Java 8 date and times, it says, "Also note that all OffsetDateTime instances will have be in UTC (have offset 0). This is because the backend stores them as UTC. Ref: https://jdbc.postgresql.org/documentation/head/java8-date-time.html This seems incorrect to me.  The backend, when using TIMESTAMP WITH TIME ZONE, stores the date+time+tzoffset, and they are not all 0 (for example, PSQL SELECT show such fields like "2019-04-18 07:35:25.061-07".  And of course OffsetDateTime seems to align with TIMESTAMP WITH TIME ZONE.  Lastly, I seem to be able to ResultSet.getObject() and PreparedStatement.setObject() with OffsetDateTime param without them all having offset 0 (I don't force the OffsetDateTime to be in the UTC zone), and they look correct. Can you clarify if that statement in the documentation is correct?  I want to make sure I code this correctly as I'm updating from the older use of java.sql.Timestamp for this purpose. Thanks, David