Here you can find the source of startOfWeek(Date date)
public static Date startOfWeek(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 startOfWeek(Date date) { if (date == null) { return date; }// w w w .ja v a 2 s . c o m Calendar c = Calendar.getInstance(); c.setTime(date); System.out.println("Today: " + c.getTime()); c.setTime(date); c.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY); Date start = c.getTime(); return newDate(start.getYear(), start.getMonth(), start.getDay(), 0, 0, 0); } /** * * @param year * @param month * @param day * @param hour * @param minute * @param sencond * @return */ public static Date newDate(int year, int month, int day, int hour, int minute, int sencond) { if (month >= 1) { month = month - 1; } return new Date(year + 1900, month, day, hour, minute, sencond); } }