jquery计算时间差

    var sTime = startTime.split(" ")[0].split("-");
    var eTime = endTime.split(" ")[0].split("-");
    var sDate = new Date(sTime[0], sTime[1], sTime[2]);
    var eDate = new Date(eTime[0], eTime[1], eTime[2]);
    var days = (Date.parse(eDate) - Date.parse(sDate)) / 1000 / 60 / 60 / 24;
    
startTime endTime 时间格式:2012-12-09 11:11:11

你可能感兴趣的:(jquery计算时间差)