Problems with Java OffsetDateTime #3228
Replies: 3 comments 4 replies
-
@martinwyser thanks for the report, I can look into this tomorrow. |
Beta Was this translation helpful? Give feedback.
-
@martinwyser OK, REL42.2.6...REL42.2.7#diff-21e3023c84d9d5fb4f5f04678a094fce6ab5af36a5e73fdfaf495646f3b720d5R485 we added toOffsetDateTime in this PR https://github.com/pgjdbc/pgjdbc/pull/1539/files This is technically correct. If you change your code to use LocalDateTime everything works as expected, or if you change your data type to timestamptz it also works as expected. This is consistent with the mapping of LocalDateTime <-> Timestamp without time zone Since LocalDateTime does not have a time zone and OffsetDateTime does. Regards Dave |
Beta Was this translation helpful? Give feedback.
-
But you are using Timestamp without Time Zone as the data type.
I think you need to either change your data type to timestamp with timezone or use LocalDateTime You should know that even with
|
Beta Was this translation helpful? Give feedback.
-
Hi everybody
I am putting OffsetDateTime values into timestamp columns, and values I read back are different. The behaviour depends on the driver version. I have an example below.
Upto to 42.2.6, the behaviour is consistent, I get back what I write. 42.2.7, 42.3...., 42.4... get values back with an offset which depends on the current systems timezone. The behaviour does not depend on the server version, I tested with 13.7 and also some 14 and 15 versions.
Here is my "test". It assumes a postgres on localhost:5555:
Here is sample output:
Beta Was this translation helpful? Give feedback.
All reactions