Advertisement
RokiAdhytama

Countdown Timer

Sep 11th, 2020
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1.  
  2. <!DOCTYPE HTML>
  3. <html>
  4. <head>
  5. <meta name="viewport" content="width=device-width, initial-scale=1">
  6. <style>
  7. p {
  8. text-align: center;
  9. font-size: 60px;
  10. margin-top: 10px;
  11. }
  12. h1 {
  13. text-align: center;
  14. }
  15. </style>
  16. </head>
  17. <body>
  18. <h1>Maintenance dulu Bro.. Sampe waktu yg dibawah habis.. kayake wkwkw.. tunggu ajalah pokoknya..</h1>
  19. <p id="demo"></p>
  20.  
  21. <script>
  22. // Set the date we're counting down to
  23. var countDownDate = new Date("Sept 9, 2020 24:00:00").getTime();
  24.  
  25. // Update the count down every 1 second
  26. var x = setInterval(function() {
  27.  
  28. // Get today's date and time
  29. var now = new Date().getTime();
  30.  
  31. // Find the distance between now and the count down date
  32. var distance = countDownDate - now;
  33.  
  34. // Time calculations for days, hours, minutes and seconds
  35. var days = Math.floor(distance / (1000 * 60 * 60 * 24));
  36. var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
  37. var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
  38. var seconds = Math.floor((distance % (1000 * 60)) / 1000);
  39.  
  40. // Output the result in an element with id="demo"
  41. document.getElementById("demo").innerHTML = days + "d " + hours + "h "
  42. + minutes + "m " + seconds + "s ";
  43.  
  44. // If the count down is over, write some text
  45. if (distance < 0) {
  46. clearInterval(x);
  47. document.getElementById("demo").innerHTML = "EXPIRED";
  48. }
  49. }, 1000);
  50. </script>
  51.  
  52. </body>
  53. </html>
  54.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement