var countDownDate1 = new Date("Apr 30, 2024 23:59:00").getTime(); // Update the count down every 1 second var x = setInterval(function() { // Get todays date and time var now = new Date().getTime(); // Find the distance between now an the count down date var distance1 = countDownDate1 - now; // Time calculations for days, hours, minutes and seconds var days1 = Math.floor(distance1 / (1000 * 60 * 60 * 24)); var hours1 = Math.floor((distance1 % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); var minutes1 = Math.floor((distance1 % (1000 * 60 * 60)) / (1000 * 60)); var seconds1 = Math.floor((distance1 % (1000 * 60)) / 1000); // Display the result in the element with id="time" document.getElementById("time1").innerHTML = days1 + "d " + hours1 + "h " + minutes1 + "m " + seconds1 + "s "; // If the count down is finished, write some text if (distance1 < 0) { clearInterval(x); document.getElementById("time1").innerHTML = "Terminato Sconto"; } }, 1000);