Here you can find the source of getLastDayOfWeek(Date date)
public static Date getLastDayOfWeek(Date date)
//package com.java2s; //License from project: Open Source License import java.util.Calendar; import java.util.Date; public class Main { public static Date getLastDayOfWeek(Date date) { Calendar calendar = Calendar.getInstance(); calendar.setTime(date);/*from w ww . ja v a 2 s . com*/ if (calendar.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY) { calendar.add(Calendar.DAY_OF_YEAR, -1); } calendar.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY); calendar.set(Calendar.HOUR_OF_DAY, 23); calendar.set(Calendar.MINUTE, 59); calendar.set(Calendar.SECOND, 59); calendar.add(Calendar.DATE, 6); return calendar.getTime(); } }