common_helper/src/main/java/com/xiongyingqi/util/DateHelper.java
public static boolean isSameWeekDates(Date date1, Date date2) {
        Calendar cal1 = Calendar.getInstance();
        Calendar cal2 = Calendar.getInstance();
        cal1.setTime(date1);
        cal2.setTime(date2);
        int subYear = cal1.get(Calendar.YEAR) - cal2.get(Calendar.YEAR);
        if (0 == subYear) {
            if (cal1.get(Calendar.WEEK_OF_YEAR) == cal2.get(Calendar.WEEK_OF_YEAR))
                return true;
        } else if (1 == subYear && 11 == cal2.get(Calendar.MONTH)) {
            // 如果12月的最后一周横跨来年第一周的话则最后一周即算做来年的第一周
            if (cal1.get(Calendar.WEEK_OF_YEAR) == cal2.get(Calendar.WEEK_OF_YEAR))
                return true;
        } else if (-1 == subYear && 11 == cal1.get(Calendar.MONTH)) {
            if (cal1.get(Calendar.WEEK_OF_YEAR) == cal2.get(Calendar.WEEK_OF_YEAR))
                return true;
        }
        return false;
    }
public static boolean isSameWeekDates(Date date1, Date date2) {
        Calendar cal1 = Calendar.getInstance();
        Calendar cal2 = Calendar.getInstance();
        cal1.setTime(date1);
        cal2.setTime(date2);
        int subYear = cal1.get(Calendar.YEAR) - cal2.get(Calendar.YEAR);
        if (0 == subYear) {
            if (cal1.get(Calendar.WEEK_OF_YEAR) == cal2.get(Calendar.WEEK_OF_YEAR))
                return true;
        } else if (1 == subYear && 11 == cal2.get(Calendar.MONTH)) {
            // 如果12月的最后一周横跨来年第一周的话则最后一周即算做来年的第一周
            if (cal1.get(Calendar.WEEK_OF_YEAR) == cal2.get(Calendar.WEEK_OF_YEAR))
                return true;
        } else if (-1 == subYear && 11 == cal1.get(Calendar.MONTH)) {
            if (cal1.get(Calendar.WEEK_OF_YEAR) == cal2.get(Calendar.WEEK_OF_YEAR))
                return true;
        }
        return false;
    }
public static boolean isSameWeekDates ( Date date1 , Date date2 ) { Calendar cal1 = Calendar . getInstance ( ) ; Calendar cal2 = Calendar . getInstance ( ) ; cal1 . setTime ( date1 ) ; cal2 . setTime ( date2 ) ; int subYear = cal1 . get ( Calendar . YEAR ) - cal2 . get ( Calendar . YEAR ) ; if ( 0 == subYear ) { if ( cal1 . get ( Calendar . WEEK_OF_YEAR ) == cal2 . get ( Calendar . WEEK_OF_YEAR ) ) return true ; } else if ( 1 == subYear && 11 == cal2 . get ( Calendar . MONTH ) ) { // 如果12月的最后一周横跨来年第一周的话则最后一周即算做来年的第一周 if ( cal1 . get ( Calendar . WEEK_OF_YEAR ) == cal2 . get ( Calendar . WEEK_OF_YEAR ) ) return true ; } else if ( - 1 == subYear && 11 == cal1 . get ( Calendar . MONTH ) ) { if ( cal1 . get ( Calendar . WEEK_OF_YEAR ) == cal2 . get ( Calendar . WEEK_OF_YEAR ) ) return true ; } return false ; }
判断二个时间是否在同一个周

@param date1
@param date2
@return
判断二个时间是否在同一个周