获取两个时间之间的天数

//获取两个时间之间的日期
public static int getDatePoor(Date endDate, Date nowDate) {
Calendar cal = Calendar.getInstance();
cal.setTime(endDate);
long time1 = cal.getTimeInMillis();
cal.setTime(nowDate);
long time2 = cal.getTimeInMillis();
long between_days=(time2-time1)/(1000*3600*24);
int parseInt = Integer.parseInt(String.valueOf(between_days));
parseInt = parseInt + 1;
return parseInt ;

}

猜你喜欢

转载自www.cnblogs.com/LinXiaoHai/p/10930610.html