标签:span 转换 格式 abs diff int logs ediff split
//new Date(aDate[1], aDate[2], aDate[0]) 兼容性比new Date(aDate[1]+"-"+ aDate[2]+"-"+aDate[0])强
//两个时间相差天数 function datedifference(sDate1, sDate2) { //sDate1和sDate2是2006-12-18格式 var aDate, oDate1, oDate2, iDays aDate = sDate1.split("-") oDate1 = new Date(aDate[1], aDate[2], aDate[0]) //转换为12-18-2006格式 aDate = sDate2.split("-") oDate2 = new Date(aDate[1], aDate[2], aDate[0]) iDays = parseInt(Math.abs(oDate1 - oDate2) / 1000 / 60 / 60 / 24) //把相差的毫秒数转换为天数 return iDays };
标签:span 转换 格式 abs diff int logs ediff split
原文地址:http://www.cnblogs.com/gaocong/p/6781573.html