Wrong timezone offset given by java.sql.ResultSet.getTime()

Bug #1279792 reported by sfc
6
This bug affects 1 person
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);
          ......
          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 post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.