[Bug 1279792] [NEW] Wrong timezone offset given by java.sql.ResultSet.getTime()
sfc
1279792 at bugs.launchpad.net
Thu Feb 13 13:11:58 UTC 2014
Public bug reported:
When I'm using java to read a time from MySQL:
ResultSet r = (SQL query);
......
r.getTime("open_time").getTime()
and this sentence gives different time (1 hour delta) on my server and my laptop (which got wrong time).
The only difference between my server and laptop is timezone. When I changed timezone of my laptop from Asia/Chongqing to Asia/Shanghai as on the server, the time reads correctly.
Then I used r.getTime("open_time").getTimezoneOffset() to check the timezone between Asia/Chongqing and Asia/Shanghai, it gives -420 and -480.
In fact, the whole China is GMT+8, which means Asia/Chongqing and Asia/Shanghai should be the same time.
Other java time functions don't have this problem.
Server:
mysql-server 5.5.35-0ubuntu0.12.04.1
java version "1.7.0_51"
OpenJDK Runtime Environment (IcedTea 2.4.4) (7u51-2.4.4-0ubuntu0.12.04.2)
OpenJDK 64-Bit Server VM (build 24.45-b08, mixed mode)
Laptop:
mysql-server 5.5.35-0ubuntu0.13.10.2
java version "1.7.0_51"
OpenJDK Runtime Environment (IcedTea 2.4.4) (7u51-2.4.4-0ubuntu0.13.10.1)
OpenJDK 64-Bit Server VM (build 24.45-b08, mixed mode)
** Affects: openjdk-7 (Ubuntu)
Importance: Undecided
Status: New
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to openjdk-7 in Ubuntu.
https://bugs.launchpad.net/bugs/1279792
Title:
Wrong timezone offset given by java.sql.ResultSet.getTime()
Status in “openjdk-7” package in Ubuntu:
New
Bug description:
When I'm using java to read a time from MySQL:
ResultSet r = (SQL query);
......
r.getTime("open_time").getTime()
and this sentence gives different time (1 hour delta) on my server and my laptop (which got wrong time).
The only difference between my server and laptop is timezone. When I changed timezone of my laptop from Asia/Chongqing to Asia/Shanghai as on the server, the time reads correctly.
Then I used r.getTime("open_time").getTimezoneOffset() to check the timezone between Asia/Chongqing and Asia/Shanghai, it gives -420 and -480.
In fact, the whole China is GMT+8, which means Asia/Chongqing and Asia/Shanghai should be the same time.
Other java time functions don't have this problem.
Server:
mysql-server 5.5.35-0ubuntu0.12.04.1
java version "1.7.0_51"
OpenJDK Runtime Environment (IcedTea 2.4.4) (7u51-2.4.4-0ubuntu0.12.04.2)
OpenJDK 64-Bit Server VM (build 24.45-b08, mixed mode)
Laptop:
mysql-server 5.5.35-0ubuntu0.13.10.2
java version "1.7.0_51"
OpenJDK Runtime Environment (IcedTea 2.4.4) (7u51-2.4.4-0ubuntu0.13.10.1)
OpenJDK 64-Bit Server VM (build 24.45-b08, mixed mode)
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/openjdk-7/+bug/1279792/+subscriptions
More information about the foundations-bugs
mailing list