Wrong timezone offset given by java.sql.ResultSet.getTime()
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
openjdk-7 (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
When I'm using java to read a time from MySQL:
ResultSet r = (SQL query);
......
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(
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-
java version "1.7.0_51"
OpenJDK Runtime Environment (IcedTea 2.4.4) (7u51-2.
OpenJDK 64-Bit Server VM (build 24.45-b08, mixed mode)
Laptop:
mysql-server 5.5.35-
java version "1.7.0_51"
OpenJDK Runtime Environment (IcedTea 2.4.4) (7u51-2.
OpenJDK 64-Bit Server VM (build 24.45-b08, mixed mode)