Here you can find the source of getWeekStart(Date date)
public static Date getWeekStart(Date date)
//package com.java2s; //License from project: Open Source License import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; public class Main { public static Date getWeekStart(Date date) { // get a calendar corresponding to the current date Calendar calendar = new GregorianCalendar(); calendar.setTime(date);/* w ww .j av a 2 s.c o m*/ // set to midnight calendar.set(Calendar.HOUR_OF_DAY, 0); calendar.set(Calendar.MINUTE, 0); calendar.set(Calendar.SECOND, 0); calendar.set(Calendar.MILLISECOND, 0); // set to previous monday calendar.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY); // return monday at midnight return calendar.getTime(); } }