Java 8 OffsetDateTime clarification
От | David Wall |
---|---|
Тема | Java 8 OffsetDateTime clarification |
Дата | |
Msg-id | e0892e70-ffcb-6161-bbc9-3f710dd52593@computer.org обсуждение исходный текст |
Ответы |
Re: Java 8 OffsetDateTime clarification
|
Список | 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 по дате отправления: