Calendar reporting different date to that set in constructor
Hi all, can anyone explain why when setting the date in the contstructor as 1/12/2007 and reading back out to the screen it is read out as "1 / 0 / 2008" ?
Here's the code:
Calendar calendar =new GregorianCalendar(2007,12,1);
int defaultdate = calendar.get(Calendar.DAY_OF_MONTH);
int defaultmonth = calendar.get(Calendar.MONTH);
int defaultyear = calendar.get(Calendar.YEAR);
System.out.println("Default date = "+defaultdate+" / "+defaultmonth+" / "+defaultyear);
System.out.println("Timezone = "+calendar.getTimeZone());
OUTPUT:
Default date = 1 / 0 / 2008
Timezone = sun.util.calendar.ZoneInfo[id="Europe/London",offset=0,dstSavings=360
0000,useDaylight=true,transitions=242,lastRule=java.util.SimpleTimeZone[id=Europ
e/London,offset=0,dstSavings=3600000,useDaylight=true,startYear=0,startMode=2,st
artMonth=2,startDay=-1,startDayOfWeek=1,startTime=3600000,startTimeMode=2,endMod
e=2,endMonth=9,endDay=-1,endDayOfWeek=1,endTime=3600000,endTimeMode=2]]
Cheers in advance for any advice on this.

