-
-
Save jezinka/b80c4d46a438081048c06a8dfb192f1b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private Date getSaturdayDate(Date date) { | |
if(date == null){ | |
date = new Date(); | |
} | |
Calendar calendarInstance = Calendar.getInstance(); | |
calendarInstance.setTime(date); | |
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