sx90
2019-12-27 17:26:31 +08:00
var Sleep = 8;
var now = new Date();
var str = '2020-01-01';
var strDate = new Date(Date.parse(str .replace(/-/g, '/')));
var StartDate = now.getTime(); //将开始日期转换成毫秒
var EndDate = strDate.getTime(); //将结束日期转换成毫秒
var time = parseInt((EndDate-StartDate)/1000/3600);
var day = parseInt(time/24);
var hour = time%24;
var time1 = day*Sleep;
var day1 = day-parseInt(time1/24);
console.log('startDate', StartDate);
console.log('endDate', EndDate);
console.log('离元旦还剩', day, '天', hour, '小时');
console.log('战斗时间还剩', day1, '天');