Let me answer my own question:
Date.getDay() returns the Day in the week from 0(Sun) to 6(Sat)
Calendar.get(DAY_OF_WEEK) returns day in the week from 1 (Sun) to 7(sat)
Also that,
System.out.println(cl.getMinimum(Calendar.DAY_OF_WEEK));   prints 1
System.out.println(cl.getMaximum   (Calendar.DAY_OF_WEEK));   prints 7

While setting the calendar, make sure that you are sending four digit year.

-Krupesha

-----Original Message-----
From: Krupesha C [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, June 01, 1999 10:31 AM
To: ND-Forum
Subject: [ND] getting DAY_OF_WEEK from java.util.Calendar


The getDay() method in java.util.Date has been deprecated and
Calendar.get(DAY_OF_WEEK) is suggested as replacement.
My problem here is that Calendar.get(DAY_OF_WEEK)  is not behaving
exactly as Date.getDay().
The value returned should be between 0 to 6 (0 for Sunday...). The value
returned by Calendar.get(DAY_OF_WEEK) is 2 short of the value returned
by Date.getDay(). Sometimes it returns 7 also
How do I work around this problem?

Thanks for your time,
Krupesha

_________________________________________________________________________

For help in using, subscribing, and unsubscribing to the discussion
forums, please go to: http://www.netdynamics.com/support/visitdevfor.html

For dire need help, email: [EMAIL PROTECTED]

Reply via email to