pastebin

Paste Search Dynamic
Recent pastes
Corona Lockdown Timer
  1. <!DOCTYPE HTML>
  2. <html>
  3. <head>
  4. <meta name="viewport" content="width=device-width, initial-scale=1">
  5. <style>
  6. p {
  7.   text-align: center;
  8.   font-size: 20px;
  9.   margin-top: 0px;
  10. }
  11. </style>
  12. </head>
  13. <body>
  14. <center>
  15.  
  16. <img src="https://i.ibb.co/D4ywLB9/Janata-Curfew-Timer-3.png" width="250">
  17. </center>
  18.  
  19. <p id="demo"></p>
  20.  
  21. <script>
  22. // Set the date we're counting down to
  23. var countDownDate = new Date("Apr 15, 2020 00: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 + " Days & " + hours + ":"
  42.   + minutes + ":" + seconds + " Hours" ;
  43.    
  44.   // If the count down is over, write some text
  45.   if (distance < 0) {
  46.     clearInterval(x);
  47.     document.getElementById("demo").innerHTML = "Finished!";
  48.   }
  49. }, 1000);
  50. </script>
  51.  
  52. </body>
  53. </html>
  54.  
Parsed in 0.000 seconds