//时间差计算两个日期之间相差天数
getDays(beginTime,endTime){
var dateDiff=endTime.getTime()-beginTime.getTime()
//相差天数
var dayDiff=Math.floor(dateDiff/(24*3600*1000))
//相差小时数
var leave1=dateDiff%(24*3600*1000)
var hours=Math.floor(leave1/(3600*1000))
//相差分钟数
var leave2=leave1%(3600*1000)
var minutes=Math.floor(leave2/(60*1000))
//秒数
var leave3=leave2%(60*1000)
var seconds=Math.round(leave3/1000)
//计算两个日期之间相差的天数、分钟数、秒数
console.log('相差天数'+dayDiff);
console.log('相差小时数'+hours);
console.log('相差分钟数'+minutes);
console.log('相差秒数'+seconds);
}