function GetDateDiff(startDate,endDate) { var startTime = new (<any>Date)(Date.parse(startDate.replace(/-/g,"/"))).getTime(); var endTime = new (<any>Date)(Date.parse(endDate.replace(/-/g,"/"))).getTime(); var days = Math.abs((startTime - endTime))/(1000*60*60*24); return days; }
//调用
var days=GetDateDiff("2017-1-2","2017-1-3");