This has to do about; "When is the Calendar object re-calculated?"
If you look in the API doc, and the source code, you can figure it out (I don't
have it in my head, but had similar problems before.).
Basically, before you supply a full range of information, the others won't be
updated/re-calculated, and as soon as you modify any of them, the object is in
an invalid state.
Niclas
Alan Boldock wrote:
> Hi Guys & Gals
>
> I'm trying to get a servlet working that takes a date time stirng and tries
> to get the day-of-the week
>
> Calendar jdate = Calendar.getInstance();
> jdate.set(sessionyear,sessionmonth,sessiondate);
> System.out.println("day:"+jdate.get(Calendar.DAY_OF_YEAR));
>
> sessionyear, sessionmonth, sessiondate are int
> this only ever returns 0 as the day:! does anybody know why?
>
> Calendar.MONTH, calendar.YEAR etc all work ok, is there a better way to get
> the
> day of the week "Monday" -- "Sunday" ?
>
> this isn't working
>
> Thanks
>
> Alan
>
> ------------------------------------------------------------
> To subscribe: [EMAIL PROTECTED]
> To unsubscribe: [EMAIL PROTECTED]
> Problems?: [EMAIL PROTECTED]
------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Problems?: [EMAIL PROTECTED]