It's The Final Countdown
unknown
plain_text
a year ago
1.5 kB
7
Indexable
<!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 { font-family: Arial, sans-serif; text-align: center; } #countdown { font-size: 36px; margin-top: 50px; } </style> </head> <body> <h1>Countdown Timer</h1> <div id="countdown"></div> <script> // Set the date we're counting down to (May 24, 2024) var countDownDate = new Date("May 24, 2024 00:00:00").getTime(); // Update the countdown every 1 second var x = setInterval(function() { // Get the current date and time var now = new Date().getTime(); // Calculate the distance between now and the countdown date var distance = countDownDate - now; // Calculate days, hours, minutes and seconds var days = Math.floor(distance / (1000 * 60 * 60 * 24)); var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60)); var seconds = Math.floor((distance % (1000 * 60)) / 1000); // Display the countdown document.getElementById("countdown").innerHTML = days + "d " + hours + "h " + minutes + "m " + seconds + "s "; // If the countdown is over, display a message if (distance < 0) { clearInterval(x); document.getElementById("countdown").innerHTML = "EXPIRED"; } }, 1000); </script> </body> </html>
Editor is loading...
Leave a Comment