I want to check if the date is weekend (lets say 28 august 2016), but for some arkane reason it returns the wrong day The code is as follows
SimpleDateFormat format = new SimpleDateFormat("yyy,mm,dd");
depDate = format.parse(departure_date);
Calendar calDeparture = Calendar.getInstance();
calDeparture.setTime(depDate);
if (calDeparture.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY && calArrival.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY) {
Log.d("true", "WEEKEND");
}else {
Log.d("FALSE", "NOT WEEKEND");
}
for some strange reason when i do Log.d("DAY OF WEEk:", Integer.toString(calDeparture.get(Calendar.DAY_OF_WEEK))); on the 28 of august it returns 4