For me, this code worked correctly, set the exact date to millisecond and try like this: -
GregorianCalendar dt = new GregorianCalendar(); dt.setTimeInMillis(getTimestampDDmmYYYY(date).getTime()); if((dt.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY| dt.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY)) return true;
Thank you Prabhat Kumar Kashyap
Prabhat kumar kashyap
source share