I am working on a project where the requirement is to have a date calculated as being the last Friday of a given month. I think I have a solution that only uses standard Ja
public static int lastSundayDate() { Calendar cal = getCalendarInstance(); cal.setTime(new Date(getUTCTimeMillis())); cal.set( Calendar.DAY_OF_MONTH , 25 ); return (25 + 8 - (cal.get(Calendar.DAY_OF_WEEK) != Calendar.SUNDAY ? cal.get(Calendar.DAY_OF_WEEK) : 8)); }