You set month to 7 which is August (month start from 0)
And August 2 is really thursday (5)
-----Original Message-----
From: Dharmendra Yadav [mailto:[EMAIL PROTECTED]]
Sent: Monday, July 02, 2001 12:26 PM
To: [EMAIL PROTECTED]
Subject: Calender Class trouble ...
hi guys,
I'm getting a bit of trouble while writing a date related servlet.
This is a Date routine to calculate some forward date on the basis on
Day , week , month , year
code look some what like this
Calendar gc = new GregorianCalendar().getInstance();
gc.clear();
gc.set(gc.YEAR, 2001);
gc.set(gc.MONTH, 7);
gc.set(gc.DAY_OF_MONTH, 2);
System.out.println(gc.get(gc.DAY_OF_WEEK));
System.out.println(gc.get(gc.DAY_OF_MONTH) +"/"+gc.get(gc.MONTH) + "/" +
gc.get(gc.YEAR));
......
......more code to get forward date
I'm setting the date as 2/7/2001 (dd/mm/yyyy format) which is monday
When I tried to print the current set day of the week , it gives me 5
Thursday which is Thursday but I expect to be 2 (Monday).
I do not know what wrong I'm doing.Can anyone explain why this is happening
and how to get 2 instead of 5 ?
regards,
Dharmendra
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html