获取两个Date类型的天数差,时差,分差

public static int getDateInterValDay(Date begin,Date end){
return (int) ((end.getTime() - begin.getTime()) / (24 * 60 * 60 * 1000));
}
public static int getDateInterValHour(Date begin,Date end){
return (int) ((end.getTime() - begin.getTime()) / (60 * 60 * 1000));
}
public static int getDateInterValSecond(Date begin,Date end){
return (int) ((end.getTime() - begin.getTime()) / (60 * 1000));
}
posted @ 2018-10-20 10:45  ergexy  阅读(1313)  评论(0编辑  收藏  举报