/**
* 计算date1间隔date2的天数
* */
private int getDaysBetweenTwoDates(Date date1,Date date2)throws Exception
{
long begin = date1.getTime();
long end = date2.getTime();
long inter = end - begin;
if(inter<=0){
return 0;
}
long dateMillSec = 24 * 60 * 60 * 1000;
long datecount = inter / dateMillSec;
long remainder = inter % dateMillSec;
if (remainder != 0) {
datecount++;
}
return (int)datecount;
}
计算两个日期相隔天数
最新推荐文章于 2021-08-30 15:46:18 发布