计算2天的日期差

1 public static int getIntervalDays(Date date, Date otherDate) {
2     long time = Math.abs(new LocalDate(date).toDate().getTime() - new LocalDate(otherDate).toDate().getTime());
3     return (int) time / (24 * 60 * 60 * 1000);
4 }

 

posted @ 2016-12-30 16:52  yweihainan  阅读(203)  评论(0编辑  收藏  举报