Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var date = new Date(2017, 3, 27, 21).getTime();
- function countdown(milliseconds) {
- console.log(milliseconds);
- var CDDate = {
- seconds: 0,
- minutes: 0,
- hours: 0,
- days: 0
- }
- x = milliseconds / 1000;
- CDDate.seconds = Math.round(x % 60);
- x /= 60;
- CDDate.minutes = Math.round(x % 60);
- x /= 60;
- CDDate.hours = Math.round(x % 25);
- x /= 24;
- CDDate.days = Math.floor(x);
- return CDDate;
- }
- var diff = date - Date.now();
- setInterval(function(){
- console.log(countdown(--diff));
- },1000)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement