None of the existing threads helped me understand why the date that I enter in the main method (2016, 25, 11) which is a Friday is popping up as true for my method isWeekend(). I've seen in the other threads people talking about setting the Calendar's first day of week to Monday but I don't see how that would change my results
public static boolean isWeekend(Calendar userDate){
if (userDate.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY ||
userDate.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY)
return true;
else return false;
}
public static void main(String[] args) {
Calendar c1 = Calendar.getInstance();
c1.set(2016, 25, 11);
System.out.println(CalendarBankHoliday.isWeekend(c1));
}
Please can someone help me understand this
Edited: it correctly displays 2016,26,11 as a weekend(true) but 2016, 27, 11 as weekday(false)