Message-ID: From: "arons (@arons)" To: "pgjdbc/pgjdbc" Date: Tue, 07 May 2024 10:16:36 +0000 Subject: Re: [pgjdbc/pgjdbc] PR #3220: setTimestamp use timestamptz db type In-Reply-To: References: List-Id: X-GitHub-Author-Login: arons X-GitHub-Comment-Id: 1592180231 X-GitHub-Comment-Type: review_comment X-GitHub-Commit: 81b5dbb2c2903ec33cbcc2aab6535f33fe79d80a X-GitHub-Issue: 3220 X-GitHub-Path: pgjdbc/src/main/java/org/postgresql/jdbc/PgPreparedStatement.java X-GitHub-Repo: pgjdbc/pgjdbc X-GitHub-Type: review_comment X-GitHub-Url: https://github.com/pgjdbc/pgjdbc/pull/3220#discussion_r1592180231 Content-Type: text/plain; charset=utf-8 (on pgjdbc/src/main/java/org/postgresql/jdbc/PgPreparedStatement.java) Your assumption is correct, so I changed it to use OffsetDateTime type so that time zone information is not lost but stored into the timestamptz. Anyway, if you use OffsetDateTime to fetch data back form the db, the time zone info is lost as illustrated by the test case TimestamptzTest.test_ZonedDateTime_StoreAndSelect(). How is the correct way to get back the information of the timezone (without using string) ? NOTE: in our application we always store dates in UTC time zone in the db to avoid any problem. If we need to store information about the time zone to use for some business logic that is stored into a separate fields independent to any stored timestamptz.