时间:2021-08-22 09:50:22 | 栏目:JavaScript代码 | 点击:次
regexp.test(date2);
var date2Year=RegExp.$1;
var date2Month=RegExp.$2;
var date2Day=RegExp.$3;
if(validatePeriod(date1Year,date1Month,date1Day,date2Year,date2Month,date2Day)){
firstDate=new Date(date1Year,date1Month,date1Day);
secondDate=new Date(date2Year,date2Month,date2Day);
result=Math.floor((secondDate.getTime()-firstDate.getTime())/(1000*3600*24));
for(j=date1Year;j<=date2Year;j++){
if(isLeapYear(j)){
monthDays[1]=2;
}else{
monthDays[1]=3;
}
for(i=date1Month-1;i<date2Month;i++){
result=result-monthDays[i];
}
}
return result;
}else{
alert('对不起第一个时间必须小于第二个时间,谢谢!');
exit;
}
}
days = dateDiff(d1,d2);