countdown / script.js
maringetxway's picture
Update script.js
72acb89 verified
raw
history blame
953 Bytes
// Set your target date here (Year, Month (0-11), Day, Hour, Minute)
const targetDate = new Date("2025-06-14T07:00:00Z"); // UTC time
function updateCountdown() {
const now = new Date();
const diff = targetDate - now;
if (diff <= 0) {
document.getElementById("countdown").innerHTML = "<h2>πŸš€ Launched!</h2>";
return;
}
const days = Math.floor(diff / (1000 * 60 * 60 * 24));
const hours = Math.floor((diff / (1000 * 60 * 60)) % 24);
const minutes = Math.floor((diff / (1000 * 60)) % 60);
const seconds = Math.floor((diff / 1000) % 60);
document.getElementById("days").textContent = String(days).padStart(2, '0');
document.getElementById("hours").textContent = String(hours).padStart(2, '0');
document.getElementById("minutes").textContent = String(minutes).padStart(2, '0');
document.getElementById("seconds").textContent = String(seconds).padStart(2, '0');
}
setInterval(updateCountdown, 1000);
updateCountdown();