Calendar conversions act strange

Hi,

The following code:

{

System.out.println(TimeZone.getDefault());

System.out.println(TimeZone.getTimeZone("GMT+02"));

Calendar c = Calendar.getInstance();

c.clear();

c.set(Calendar.HOUR_OF_DAY, 14);

c.setTimeZone(TimeZone.getTimeZone("GMT+02"));

System.out.println(c.getTime());

}

Produces:

sun.util.calendar.ZoneInfo[id="Europe/Minsk",offset=7200000,dstSavings=3600000,useDaylight=true,transitions=121,lastRule=java.util.SimpleTimeZone[id=Europe/Minsk,offset=7200000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=2,startMonth=2,startDay=-1,startDayOfWeek=1,startTime=7200000,startTimeMode=1,endMode=2,endMonth=9,endDay=-1,endDayOfWeek=1,endTime=7200000,endTimeMode=1]]

sun.util.calendar.ZoneInfo[id="GMT+02:00",offset=7200000,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]

Thu Jan 0115:00:00 EET 1970

when executed on jdk1.5.0_11

and

....

Thu Jan 0114:00:00 EET 1970

when executed on jdk1.5.0_06

I think the second is the right result.

Does anyone think different?

Best Regards

Pavel

[1290 byte] By [pavelsza] at [2007-11-26 17:36:42]
# 1
In 1970 Belarus had timezone UTC+3, so the first one is correct. http://www.timeanddate.com/worldclock/timezone.html?n=285&syear=1970
jsalonena at 2007-7-9 0:04:49 > top of Java-index,Java Essentials,Java Programming...
# 2
Amazing!!!Joni, thanks...How did you guess ?!
pavelsza at 2007-7-9 0:04:49 > top of Java-index,Java Essentials,Java Programming...
# 3
it's hardly a matter of guessing, the site I linked to is among thefirst in the results when you search for "belarus dst" on the internet
jsalonena at 2007-7-9 0:04:49 > top of Java-index,Java Essentials,Java Programming...