Here you can find the source of isSameWeekDates(Date date1, Date date2)
static boolean isSameWeekDates(Date date1, Date date2)
//package com.java2s; //License from project: Apache License import java.util.Calendar; import java.util.Date; public class Main { static boolean isSameWeekDates(Date date1, Date date2) { long diff = getMonday(date1).getTime() - getMonday(date2).getTime(); if (Math.abs(diff) < 1000 * 60 * 60 * 24) { return true; } else {//w w w .j a v a 2 s .c o m return false; } } public static Date getMonday(Date date) { Calendar c = Calendar.getInstance(); c.setTime(date); c.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY); return c.getTime(); } }