Advertisement
Guest User

Untitled

a guest
Mar 18th, 2019
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. const second = 1000,//ms
  2. minute = second * 60,
  3. hour = minute * 60,
  4. day = hour * 24;
  5.  
  6. let countDown = new Date('Sep 30, 2019 00:00:00').getTime(),
  7. x = setInterval(function() {
  8.  
  9. let now = new Date().getTime(),
  10. distance = countDown - now;
  11.  
  12. document.getElementById('days').innerText = Math.floor(distance / (day)),
  13. document.getElementById('hours').innerText = Math.floor((distance % (day)) / (hour)),
  14. document.getElementById('minutes').innerText = Math.floor((distance % (hour)) / (minute)),
  15. document.getElementById('seconds').innerText = Math.floor((distance % (minute)) / second);
  16. }, second)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement