DateDiff : function(startDate, endDate){
var aDate, oDate1, oDate2, iDays ;
aDate = startDate.split('-');
oDate1 = new Date(aDate[1]+'-'+aDate[2]+'-'+aDate[0]) ;
aDate = endDate.split('-');
oDate2 = new Date(aDate[1]+'-'+ aDate[2] +'-'+aDate[0]);
iDays = parseInt(Math.abs(oDate1 -oDate2)/1000/60/60/24); //把相差的毫秒数转换为天数
return iDays ;
}
JS 比较两个字符串日期相差的天数
最新推荐文章于 2023-07-15 17:36:51 发布