Void Void - 3 months ago 5x
Java Question

How to get the Calendar dates in between?

I want to get the dates in between the calendar, but for some reason this does not work. Any suggestions why? Thanks.

public boolean verifyDate(Calendar cal) {
Calendar toDate = Calendar.getInstance();
Calendar fromDate = Calendar.getInstance();
return !((fromDate.after(cal) && toDate.before(cal)) || DateUtils.isSameDay(fromDate, cal) || DateUtils.isSameDay(toDate, cal));


fromDate.after(cal) - will return true if fromDate will be after the cal, similar thing with before.

If you want to check that cal is between two dates use:

return cal.after(fromDate) && cal.before(toDate) 
    && !(DateUtils.isSameDay(fromDate, cal) || DateUtils.isSameDay(toDate, cal));