posted 15 years ago
Well this is where I am up against a brick wall....
I can use:
Calendar cal = Calendar.getInstance();
to create a new instance of Calendar and then....
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");
String text = df.format(System.currentTimeMillis());
logFile.println("date is " + text);
cal.setTime(df.parse(text));
logFile.println("Calendar is " + cal.getTime());
logFile.println("Calendar is " + cal.getInstance());
outputs the following:
date is 2008-11-14T11:58:11+0000
Calendar is Fri Nov 14 11:58:11 GMT 2008
Calendar is java.util.GregorianCalendar[time=1226663891532,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id="Europe/London",offset=0,dstSavings=3600000,useDaylight=true,transitions=242,lastRule=java.util.SimpleTimeZone[id=Europe/London,offset=0,dstSavings=3600000,useDaylight=true,startYear=0,startMode=2,startMonth=2,startDay=-1,startDayOfWeek=1,startTime=3600000,startTimeMode=2,endMode=2,endMonth=9,endDay=-1,endDayOfWeek=1,endTime=3600000,endTimeMode=2]],firstDayOfWeek= 2,minimalDaysInFirstWeek=4,ERA=1,YEAR=2008,MONTH=10,WEEK_OF_YEAR=46,WEEK_OF_MONTH=2,DAY_OF_MONTH=14,DAY_OF_YEAR=319,DAY_OF_WEEK=6,DAY_OF_WEEK_IN_MONTH=2,AM_PM=0,HOUR=11,HOUR_OF_DAY=11,MINUTE=58,SECOND=11,MILLISECOND=532,ZONE_OFFSET=0,DST_OFFSET=0]