Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
private Date getSaturdayDate(Date date) {
if(date == null){
date = new Date();
Calendar calendarInstance = Calendar.getInstance();
if (calendarInstance.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY) {
return date;
calendarInstance.add(Calendar.DAY_OF_WEEK, -calendarInstance.get(Calendar.DAY_OF_WEEK));
return calendarInstance.getTime();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment