var countDownDate = new Date("Oct 05, 2020 16:00:00").getTime(); var x = setInterval(function() { var now = new Date().getTime(); var distance = countDownDate - now; var days = Math.floor(distance / (1000 * 60 * 60 * 24)); var daysStr = "0" + days.toString(); var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); var hoursStr = "0" + hours.toString(); var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60)); var minutesStr = "0" + minutes.toString(); var seconds = Math.floor((distance % (1000 * 60)) / 1000); var secondsStr = "0" + seconds.toString(); if (distance < 0) { clearInterval(x); document.getElementsByClassName("totm")[0].classList.add('d-block'); document.getElementsByClassName("totm")[0].classList.remove('d-none'); } }, 1000);