Phalgun
Phalgun

Reputation: 1494

Timezone differences in Java 8 and Java 7

The below sample java code print dates. DateTest.java

import java.util.GregorianCalendar;
import java.util.Calendar;

public class DateTest{

     public static void main(String []args){
         Calendar cal = new GregorianCalendar();
         cal.set(2013, 10, 13, 0, 0, 0);
         System.out.println(cal.getTime());

     }
}

However, there is a time zone when run with Java 7 and 8:- $ unset TZ

$ /sv/app/9.00/java/product/jdk1.8.0_66/bin/java DateTest 
Wed Nov 13 00:00:00 AEST 2013

$ /sv/app/9.00/java/product/jdk1.7.0_60/bin/java DateTest
Wed Nov 13 00:00:00 EST 2013

I've tried searching for documentation but could find a reference to this enhancement/aberration.

Upvotes: 4

Views: 1016

Answers (1)

Adam Michalik
Adam Michalik

Reputation: 9965

See the JRE release notes:

JDK 7u60

IANA Data 2014b. JDK 7u60 contains IANA time zone data version 2014b

JDK 8u66

IANA Data 2015f. JDK 8u66 contains IANA time zone data version 2015f.

Then you can see in the "Timezone Data Versions in the JRE Software" that there has been a change in TZ DB 2014f:

Australian eastern time zone abbreviations are now AEST/AEDT not EST, and similarly for the other Australian zones. That is, for eastern standard and daylight saving time the abbreviations are AEST and AEDT instead of the former EST for both; similarly, ACST/ACDT, ACWST/ACWDT, and AWST/AWDT are now used instead of the former CST, CWST, and WST. This change does not affect UTC offsets, only time zone abbreviations.

Upvotes: 4

Related Questions