Here is the real calendar now:
March 2015
Su Mo Tu We Th Fr Sa
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31
And I get DAY_OF_WEEK
of 2015/3/24
like this:
public class TestCalendar {
public static void main(String[] argvs){
Calendar cal = Calendar.getInstance();
cal.setFirstDayOfWeek(Calendar.MONDAY);
cal.set(2015,Calendar.MARCH,24);
System.out.println(cal.get(Calendar.DAY_OF_WEEK));
}
}
Since I have cal.setFirstDayOfWeek
to MONDAY
the result I expecting is 2
, but Whatever day I set to the first day of week
(have tried SUNDAY and others) .It kept show me the same result which is 3
. So It seemed that firstDayOfWeek
won't affect the result.
Have I do something wrong?
EDIT
I just figured and thanks to answers below, that this setFirstDayOfWeek
will not affect the result of get(Calendar.DAY_OF_WEEK)
nor get(Calendar.WEEK_OF_YEAR)
Then what is this method setFirstDayOfWeek()
designed for?
I mean How can I told the program that I want 2015/3/29
be the last day of the 12th week instead of treating it as the first day of the 13th week?