pgjdbc/pgjdbc GitHub issues and pull requests (mirror)
help / color / mirror / Atom feedFrom: labanovichttps (@labanovichttps) <[email protected]>
To: pgjdbc/pgjdbc <[email protected]>
Subject: [pgjdbc/pgjdbc] issue #3692: Wrong time formatting ResultSet.getTime(); for Europe/Belgrade and "Europe/Prague"
Date: Wed, 25 Jun 2025 10:32:07 +0000
Message-ID: <[email protected]> (raw)
**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);
}
}
}
}
}
```
<img width="475" alt="Image" src="https://github.com/user-attachments/assets/025603d1-eb46-4708-a047-3a901f9f3acc"; />
view thread (8+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: github://pgjdbc/pgjdbc
Cc: [email protected], [email protected]
Subject: Re: [pgjdbc/pgjdbc] issue #3692: Wrong time formatting ResultSet.getTime(); for Europe/Belgrade and "Europe/Prague"
In-Reply-To: <<[email protected]>>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox