Java 8 OffsetDateTime clarification - Mailing list pgsql-jdbc

From David Wall
Subject Java 8 OffsetDateTime clarification
Date
Msg-id e0892e70-ffcb-6161-bbc9-3f710dd52593@computer.org
Whole thread Raw
Responses Re: Java 8 OffsetDateTime clarification  (Thomas Kellerer <spam_eater@gmx.net>)
List pgsql-jdbc
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






pgsql-jdbc by date:

Previous
From: Dave Cramer
Date:
Subject: [pgjdbc/pgjdbc] 38041f: Fix maven coordinates
Next
From: Thomas Kellerer
Date:
Subject: Re: Java 8 OffsetDateTime clarification