Message-ID: From: "labanovichttps (@labanovichttps)" To: "pgjdbc/pgjdbc" Date: Wed, 25 Jun 2025 10:32:07 +0000 Subject: [pgjdbc/pgjdbc] issue #3692: Wrong time formatting ResultSet.getTime(); for Europe/Belgrade and "Europe/Prague" List-Id: X-GitHub-Assignees: davecramer X-GitHub-Author-Id: 65848887 X-GitHub-Author-Login: labanovichttps X-GitHub-Issue: 3692 X-GitHub-Repo: pgjdbc/pgjdbc X-GitHub-State: open X-GitHub-Type: issue X-GitHub-Url: https://github.com/pgjdbc/pgjdbc/issues/3692 Content-Type: text/plain; charset=utf-8 **Describe the issue** For Europe/Belgrade and "Europe/Prague" timezones, the wrong current_time formatting. They're different because of the DST(summer time +2). It happens because you set 1970-01-01(winter time +1) **Driver Version?** 42.7.7 **Java Version?** 21 **OS Version?** MacOS Sequoia **PostgreSQL Version?** **To Reproduce** `SELECT current_time, current_timestamp;` with Europe/Belgrade or Europe/Prague timezone. **Expected behaviour** The current local time as same as current_timestamp is **Logs** If possible PostgreSQL logs surrounding the occurrence of the issue Additionally logs from the driver can be obtained adding Using the following template code make sure the bug can be replicated in the driver alone. ``` import java.io.IOException; import java.sql.*; import java.util.TimeZone; public class Main { public class Main { public static void main(String[] args) throws SQLException, IOException, InterruptedException, ClassNotFoundException { TimeZone.setDefault(TimeZone.getTimeZone("Europe/Prague")); String url = "jdbc:postgresql://localhost:5432/postgres"; String user = "postgres"; String pass = "pass"; Class.forName("org.postgresql.Driver"); try (Connection con = DriverManager.getConnection(url, user, pass); Statement st = con.createStatement(); ResultSet rs = st.executeQuery("select current_time, current_timestamp")) { if (rs.next()) { Time s = rs.getTime(1); Timestamp ts = rs.getTimestamp(2); System.out.println("My date " + s); System.out.println("My timestamp " + ts); } } } } } ``` Image