Advertisement
Guest User

Untitled

a guest
Apr 26th, 2015
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. var date = new Date(2017, 3, 27, 21).getTime();
  2. function countdown(milliseconds) {
  3. console.log(milliseconds);
  4. var CDDate = {
  5. seconds: 0,
  6. minutes: 0,
  7. hours: 0,
  8. days: 0
  9. }
  10. x = milliseconds / 1000;
  11. CDDate.seconds = Math.round(x % 60);
  12. x /= 60;
  13. CDDate.minutes = Math.round(x % 60);
  14. x /= 60;
  15. CDDate.hours = Math.round(x % 25);
  16. x /= 24;
  17. CDDate.days = Math.floor(x);
  18. return CDDate;
  19. }
  20.  
  21. var diff = date - Date.now();
  22. setInterval(function(){
  23. console.log(countdown(--diff));
  24. },1000)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement