Js 时间间隔计算(间隔天数)
Js 时间间隔计算(间隔天数)
1
2
3
4
5
6
7
|
function
GetDateDiff(startDate,endDate)
{
var
startTime =
new
Date(Date.parse(startDate.replace(/-/g,
"/"
))).getTime();
var
endTime =
new
Date(Date.parse(endDate.replace(/-/g,
"/"
))).getTime();
var
dates = Math.abs((startTime - endTime))/(1000*60*60*24);
return
dates;
}
|