public static boolean isSameWeek(final Date date1,final Date date2){
  final Calendar cal1=Calendar.getInstance();
  cal1.setFirstDayOfWeek(Calendar.MONDAY);
  cal1.setTime(date1);
  final Calendar cal2=Calendar.getInstance();
  cal2.setFirstDayOfWeek(Calendar.MONDAY);
  cal2.setTime(date2);
  return cal1.get(Calendar.ERA) == cal2.get(Calendar.ERA) && cal1.get(Calendar.YEAR) == cal2.get(Calendar.YEAR) && cal1.get(Calendar.WEEK_OF_YEAR) == cal2.get(Calendar.WEEK_OF_YEAR);
}

public static boolean isSameWeek ( final Date date1 , final Date date2 ) { final Calendar cal1 = Calendar . getInstance ( ) ; cal1 . setFirstDayOfWeek ( Calendar . MONDAY ) ; cal1 . setTime ( date1 ) ; final Calendar cal2 = Calendar . getInstance ( ) ; cal2 . setFirstDayOfWeek ( Calendar . MONDAY ) ; cal2 . setTime ( date2 ) ; return cal1 . get ( Calendar . ERA ) == cal2 . get ( Calendar . ERA ) && cal1 . get ( Calendar . YEAR ) == cal2 . get ( Calendar . YEAR ) && cal1 . get ( Calendar . WEEK_OF_YEAR ) == cal2 . get ( Calendar . WEEK_OF_YEAR ) ; }
determines whether the specified date1 is the same week with the specified date2 .
