js中计算两个日期之差
var aBgnDate, aEndDate; var oBgnDate, oEndDate; var nYlts; aBgnDate = strBgnDate.split('-'); aEndDate = strEndDate.split('-'); oBgnDate = new Date(aBgnDate[1] + '-' + aBgnDate[2] + '-' + aBgnDate[0]); oEndDate = new Date(aEndDate[1] + '-' + aEndDate[2] + '-' + aEndDate[0]); //把相差的毫秒数转换为天数 nYlts = parseInt(Math.abs(oEndDate - oBgnDate) / 1000 / 60 / 60 / 24);