> Greetings,
>
[quoted text clipped - 12 lines]
> Dateg: 13
> Dateg:
java.util.GregorianCalendar[time=1093827446353,areFieldsSet=true,areAllField
sSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id="GMT-07:00",offset
=-25200000,dstSavings=0,useDaylight=false,transitions=0,lastRule=null],first
> DayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2004,MONTH=7,
WEEK_OF_YEAR=36,WEEK_OF_MONTH=5,DAY_OF_MONTH=29,DAY_OF_YEAR=242,DAY_OF_WEEK=
> 1,DAY_OF_WEEK_IN_MONTH=5,
AM_PM=1,HOUR=5,HOUR_OF_DAY=17,MINUTE=57,SECOND=26,MILLISECOND=353,ZONE_OFFSE
> T=-25200000,DST_OFFSET=0]
>
> Why does "System.out.println("Dateg: " + todayg.SECOND);" produce a value of
> 13 when "System.out.println("Dateg: " + todayg);" has SECOND=26 ????
>
> Dazed and Confused...
Because Calendar.SECOND does not represent the seconds value, it is simply a
static (constant) integer representing the field number, which happens to be
the 13th field in Calendar. Your code will always print 13 regardless of the
time the calendar was instantiated. Similarly, todayg.YEAR will print 1,
todayg.MONTH will be 2 ... etc
I think what you're after is todayg.get(Calendar.SECOND)
Kurt Harless - 30 Aug 2004 03:36 GMT
Much thanks!!!
Less Dazed, still Confused
> > Greetings,
> >
[quoted text clipped - 12 lines]
> > Dateg: 13
> > Dateg:
java.util.GregorianCalendar[time=1093827446353,areFieldsSet=true,areAllField
sSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id="GMT-07:00",offset
=-25200000,dstSavings=0,useDaylight=false,transitions=0,lastRule=null],first
> > DayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2004,MONTH=7,
WEEK_OF_YEAR=36,WEEK_OF_MONTH=5,DAY_OF_MONTH=29,DAY_OF_YEAR=242,DAY_OF_WEEK=
> > 1,DAY_OF_WEEK_IN_MONTH=5,
AM_PM=1,HOUR=5,HOUR_OF_DAY=17,MINUTE=57,SECOND=26,MILLISECOND=353,ZONE_OFFSE
> > T=-25200000,DST_OFFSET=0]
> >
[quoted text clipped - 11 lines]
>
> I think what you're after is todayg.get(Calendar.SECOND)
Murray - 30 Aug 2004 09:01 GMT
> Much thanks!!!
>
> Less Dazed, still Confused
One down, one to go ... :-)
What are you still confused about? Or is that just your normal mental state?
:-P