Message-ID: From: "anaconda875 (@anaconda875)" To: "pgjdbc/pgjdbc" Date: Fri, 08 Nov 2024 01:42:51 +0000 Subject: Re: [pgjdbc/pgjdbc] issue #3433: Same timestamps, but different values when saved (executeUpdate) to database In-Reply-To: References: List-Id: X-GitHub-Author-Login: anaconda875 X-GitHub-Comment-Id: 2463585365 X-GitHub-Comment-Type: issue_comment X-GitHub-Edited-At: 2024-11-08T01:45:04Z X-GitHub-Issue: 3433 X-GitHub-Repo: pgjdbc/pgjdbc X-GitHub-Type: comment X-GitHub-Url: https://github.com/pgjdbc/pgjdbc/issues/3433#issuecomment-2463585365 Content-Type: text/plain; charset=utf-8 1. For Date: Given a Date `2024-11-07 15:08:57.379` with TimeZone of `GMT-2`: `preparedStatement.setTimestamp( 1, timestamp, Calendar.getInstance( TimeZone.getTimeZone( "GMT-2" ) ) );` Expected: When `executeUpdate` should persist `2024-11-07 13:08:57.379` Actual: as Expected 2. For OffsetDateTime: Given an OffsetDatime `2024-11-07 15:08:57.379` with TimeZone of `GMT-2`: `preparedStatement.setObject( 2, offsetDateTime .atZoneSameInstant( TimeZone.getTimeZone( "GMT-2" ).toZoneId() ) .toOffsetDateTime(), SqlTypes.TIMESTAMP_WITH_TIMEZONE );` Expected: When `executeUpdate` should persist `2024-11-07 13:08:57.379` (same as 1) Actual: `2024-11-07 15:08:57.379`