countdown / index.html
multimodalart's picture
multimodalart HF Staff
Update index.html
0012b10 verified
Raw History Blame Contribute Delete
1.55 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Countdown Timer</title>
<style>
body {
min-height: 100vh;
margin: 0;
display: grid;
place-items: center;
font-family: Arial, sans-serif;
text-align: center;
background: #f4f4f4;
}
#countdown {
font-size: 2rem;
font-weight: bold;
}
</style>
</head>
<body>
<main>
<h1>Countdown</h1>
<div id="countdown">Loading...</div>
</main>
<script>
// August 2, 2026 at 9:00 AM, UTC-07:00
const targetTime = new Date("2026-08-02T09:00:00-07:00").getTime();
const countdownElement = document.getElementById("countdown");
function updateCountdown() {
const remaining = targetTime - Date.now();
if (remaining <= 0) {
countdownElement.textContent = "The countdown is complete!";
clearInterval(timer);
return;
}
const days = Math.floor(remaining / (1000 * 60 * 60 * 24));
const hours = Math.floor(
(remaining % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)
);
const minutes = Math.floor(
(remaining % (1000 * 60 * 60)) / (1000 * 60)
);
const seconds = Math.floor(
(remaining % (1000 * 60)) / 1000
);
countdownElement.textContent =
`${days}d ${hours}h ${minutes}m ${seconds}s`;
}
updateCountdown();
const timer = setInterval(updateCountdown, 1000);
</script>
</body>
</html>