js 兩個時間差

  function daysElapsed(date1,date2) {
   var item1 = date1.split("-");
   var item2 = date2.split("-");
    var difference = Date.UTC(item2[0],item2[1],item2[2],0,0,0)
                   - Date.UTC(item1[0],item1[1],item1[2],0,0,0);
    return difference/1000/60/60/24;
 }it

var timeDifference = daysElapsed(startDate,endDate);io

相關文章
相關標籤/搜索