public static long between(Date s, Date e, long unit) {

        Date start;
        Date end;
        if (s.before(e)) {
            start = s;
            end = e;
        } else {
            start = e;
            end = s;
        }
        long diff = end.getTime() - start.getTime();
        return diff / unit;
    }
public static long between(Date s, Date e, long unit) {

        Date start;
        Date end;
        if (s.before(e)) {
            start = s;
            end = e;
        } else {
            start = e;
            end = s;
        }
        long diff = end.getTime() - start.getTime();
        return diff / unit;
    }
public static long between ( Date s , Date e , long unit ) { Date start ; Date end ; if ( s . before ( e ) ) { start = s ; end = e ; } else { start = e ; end = s ; } long diff = end . getTime ( ) - start . getTime ( ) ; return diff / unit ; }
判断两个日期相差的时长

@param s
起始日期
@param e
结束日期
@param unit
相差的单位 T_1MS 毫秒 T_1S 秒 T_1M 分 T_1H 时 T_1D 天 T_1W 周
@return 相差的数量
判断两个日期相差的时长