I try to System.out the same strings
System.out.println(" DATE 29 " + new Date(1330462800000l) + " Date 01 "
+ new Date(1330549200000l));
but I have different results when I check it in Build(running in console mode) and when i run application from eclipse.
output from eclipse(seems like it is correct result):
DATE 29 Wed Feb 29 00:00:00 EET 2012 Date 01 Thu Mar 01 00:00:00 EET 2012
output from build(console mode)
DATE 29 Tue Feb 28 23:00:00 EET 2012 Date 01 Wed Feb 29 23:00:00 EET 2012
Sorry for stupid question, but do you have any ideas about possible reasons?
PS:I use maven+tycho to make build, packaging-type eclipse-repository.(if it realy matter)
EDIT: In Eclipse I looked at timeZone value:
Calendar calendar=Calendar.getInstance();
System.out.println("!!!time zone before: " + calendar.getTimeZone());
!!!time zone before: 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]]
then I set timezone with hardcoded zoneId and made build
calendar.setTimeZone(TimeZone.getTimeZone("Europe/Minsk"));
haven't any results
EDIT: I use different versions and architectures of jres in build and eclipse..Could it be the reason? EDIT:
System.out.println("!!!!!! system.timezone " + System.getProperty("user.timezone"));
System.setProperty("user.timezone", "Europe/Minsk");
System.out.println("!!!!!! system.timezone " + System.getProperty("user.timezone"));
!!!!!! system.timezone Europe/Minsk
!!!!!! system.timezone Europe/Minsk!!!calendar time after zone: 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]]
Correct timezone. but date is still wrong