我正在尝试从现在到上一个日期修复我的时间计数器,但是当我执行它时。它表示5个小时,应该是90天00分钟:00秒和00毫秒。所以我正在尝试修复它,但是我很讨厌它
var countDownDate = new Date("Feb 28, 2019 08:10:34").getTime();
var countdownfunction = setInterval(function() {
var now = new Date().getTime();
var distance = countDownDate - now;
var days = Math.floor(distance / (1000 * 60 * 60 * 24));
var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
var seconds = Math.floor((distance % (1000 * 60)) / 1000);
console.log(days);
document.getElementById("demo").innerHTML = days + "d " + hours + "h " + minutes + "m " + seconds + "s ";
if (distance < 0) {
clearInterval(countdownfunction);
document.getElementById("demo").innerHTML = "EXPIRED";
}
}, 1000);