This discussion is archived
4 Replies Latest reply: May 14, 2007 1:52 PM by 798701 RSS

Wrong week day when using Calendar

807606 Newbie
Currently Being Moderated
Today is the 14. of May which is a Monday. Calendar.MONDAY = 2 and therefore :
Calendar rightNow = Calendar.getInstance();
int weekday = rightNow.get(Calendar.DAY_OF_WEEK);
System.out.println(weekday);
should print 2, which it also does. But when I want to see which weekday the first of June is I do:
rightNow.add(Calendar.MONTH, 1);
weekday = rightNow.get(Calendar.DAY_OF_WEEK);
System.out.println(weekday);
But it prints 5. According to my physical calendar the first of June is a Friday and 6 should therefore have been printed. What is wrong?