Here you can find the source of getLastDayOfWeek(Date date)
public static Date getLastDayOfWeek(Date date)
//package com.java2s; import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; public class Main { public static Date getLastDayOfWeek(Date date) { Calendar c = new GregorianCalendar(); c.setFirstDayOfWeek(Calendar.MONDAY); c.setTime(date);/*from w w w .j a va 2s . com*/ c.set(Calendar.DAY_OF_WEEK, c.getFirstDayOfWeek() + 6); // Sunday return c.getTime(); } @SuppressWarnings("deprecation") public static Date getFirstDayOfWeek(Date date) { Calendar c = new GregorianCalendar(); c.setFirstDayOfWeek(Calendar.MONDAY); c.setTime(date); c.set(Calendar.DAY_OF_WEEK, c.getFirstDayOfWeek()); // Monday return c.getTime(); } }