const targetDate = new Date("March 17, 2027 23:59:59").getTime();
const interval = setInterval(() => {
const now = new Date().getTime();
const distance = targetDate - now;
// Calculate time units
const days = Math.floor(distance / (1000 * 60 * 60 * 24));
const hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
const minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
const seconds = Math.floor((distance % (1000 * 60)) / 1000);
// Display results
document.getElementById("days").innerText = days;
document.getElementById("hours").innerText = hours;
document.getElementById("minutes").innerText = minutes;
document.getElementById("seconds").innerText = seconds;
// Stop countdown when date is reached
if (distance < 0) {
clearInterval(interval);
document.querySelector(".countdown-container").innerHTML = "Event Started!";
}
}, 1000);
top of page
bottom of page