1 function GetTime(firstDate, secondDate) { 2 // 1.对事件进行处理 3 var firsttime = Date.parse(firstDate + " 00:00:00"); 4 var secondtime = Date.parse(secondDate + " 00:00:00"); 5 // 2.获取时间间隔 6 var timespan = secondtime - firsttime; 7 // 3.获取天 8 var day = Math.floor(timespan / 1000 / 60 / 60 / 24); 9 // 4.获取小时 10 var hour = Math.floor(timespan / 1000 / 60 / 60); 11 // 5.获取分钟 12 var minute = Math.floor(timespan / 1000 / 60 - hour * 60); 13 // 6.获取秒 14 var second = timespan / 1000 - hour * 60 * 60 - minute * 60; 15 return day + "@" + hour + "@" + minute + "@" + second; 16 }