Question

IBM vs Oracle/Sun JDK, java.util.Timzone behaving differently ,

IBM JDK 1.5 vs Sun/Oracle JDK 1.6

import java.util.*;
class TimeTest {

public static void main(String args[]){

long now = System.currentTimeMillis();

System.out.println("EST : " + TimeZone.getTimeZone("EST").getOffset(now));
System.out.println("US/Eastern : " + TimeZone.getTimeZone("US/Eastern").getOffset(now));

}
}


***IBM JVM ouput

EST : -14400000
US/Eastern : -14400000

Oracle JVM

EST : -18000000
US/Eastern : -14400000
IBM JDK

java -version

java version "1.5.0"
Java(TM) 2 Runtime Environment, Standard Edition (build pxi32devifx-20090811 (SR10 +IZ56666+IZ56751))
IBM J9 VM (build 2.3, J2RE 1.5.0 IBM J9 2.3 Linux x86-32 j9vmxi3223-20090707 (JIT enabled)
J9VM - 20090706_38445_lHdSMr
JIT  - 20090623_1334_r8
GC   - 200906_09)
JCL  - 20090811


Oracle JDK

java -version

java version "1.6.0_24"                                         
Java(TM) SE Runtime Environment (build 1.6.0_24-b07)            
Java HotSpot(TM) Client VM (build 19.1-b02, mixed mode, sharing)

update , tested with IBM JDK 6 , it matches the ouput of oracle/sun java -version java version "1.6.0" Java(TM) SE Runtime Environment (build pxi3260sr6ifix-20091015_01(SR6+152211+155930+156106)) IBM J9 VM (build 2.4, JRE 1.6.0 IBM J9 2.4 Linux x86-32 jvmxi3260sr6-20091001_43491 (JIT enabled, AOT enabled) J9VM - 20091001_043491 JIT - r9_20090902_1330ifx1 GC - 20090817_AA) JCL - 20091006_01

java TimeTest
EST : -18000000
US/Eastern : -14400000***
Was it helpful?

Solution

I think it's safe to say your IBM JDK install has a much older timezone database that the other JDK installs. JDK 1.5 was released in 2004.

OTHER TIPS

IBM tells us the answer:

In 2006, the meaning of the EST time zone identifier changed in the Olson database. Historically, EST referred to the American Eastern Standard Time and made adjustments for daylight saving time. Following the change, EST refers to Eastern Standard Time with no adjustment for daylight saving time. A new identifier EST5EDT was also introduced that had the same meaning as the original EST identifier.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top