You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[jdbc] Incorrect DateTime results when writing numeric data with use_time_zone property #2065
The DateTime results will -8h when inserting long values using PrepareStatement with use_server_time_zone=false&use_time_zone=Asia/Shanghai. (ClickHouse Server timezone is UTC)
Expected: '1970-01-01 08:00:00.001000000'
Actual: '1970-01-01 00:00:00.001000000'
(timezone is Asia/Shanghai)
Hi team,
I think the method in com.clickhouse.data.ClickHouseValues.java:282 is incorrect. Why should a numeric type representing a Unix timestamp, which inherently lacks timezone context, be directly converted to a LocalDateTime assuming it's in the UTC time zone?
The concern here is that the conversion assumes the input Unix timestamp is in UTC without verifying if this is correct for all cases, which can lead to time zone discrepancies when clients operate in different time zones.
use_server_time_zone has no effect on numbers. Driver doesn't know target column type and no type hint is provided.
Besides driver is not to convert data.
Activity
haishui126 commentedon Jan 3, 2025
Hi team,
I think the method in com.clickhouse.data.ClickHouseValues.java:282 is incorrect. Why should a numeric type representing a Unix timestamp, which inherently lacks timezone context, be directly converted to a LocalDateTime assuming it's in the UTC time zone?
The concern here is that the conversion assumes the input Unix timestamp is in UTC without verifying if this is correct for all cases, which can lead to time zone discrepancies when clients operate in different time zones.
chernser commentedon Aug 28, 2025
Good day, @haishui126 !
Sorry for a delayed answer and thank you for reporting the issue!
We will look into it but this is a v1.
Would you please try v2 (set by default after 0.8.0)? Thanks!
dyjwi4-wiqvyr-cyZbem commentedon Aug 28, 2025
chernser commentedon Feb 26, 2026
Good day, @haishui126 !
use_server_time_zonehas no effect on numbers. Driver doesn't know target column type and no type hint is provided.Besides driver is not to convert data.
We have created a guide for how to work with Date Time https://clickhouse.com/docs/integrations/language-clients/java/jdbc_date_time_guide .
Thanks!