I'm trying to create a method which is checking if "today" is between Monday and Friday. For this I get with this line
'int day = Calendar.DAY_OF_WEEK;'
boolean DAY = true
boolean DAY = false
int day = Calendar.DAY_OF_WEEK;
ArrayList<Integer> daylist = new ArrayList<Integer>();
DAY = true;
DAY = false;
Wow, that's like trying to kill a mosquito with a thermo-nuclear warhead :-)
DAY_OF_WEEK is not the day of the week, it's a field number (with the value 7) to be passed to the getter to retrieve the day of the week. The only time
Calendar.DAY_OF_WEEK itself will match an actual day will be on Saturdays.
You can use code such as:
Calendar myDate = Calendar.getInstance(); // set this up however you need it. int dow = myDate.get (Calendar.DAY_OF_WEEK); boolean isWeekday = ((dow >= Calendar.MONDAY) && (dow <= Calendar.FRIDAY));
isWeekday will be true if and only if the day from
myDate was Monday through Friday inclusive.