/
script.js
20 lines (15 loc) · 719 Bytes
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
var countDownDate = new Date('January 01, 100000 23:59:59').getTime();
var x = setInterval(function () {
var now = new Date().getTime();
var distance = countDownDate - now;
var days = Math.floor(distance / (1000 * 60 * 60 * 24));
var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
var seconds = Math.floor((distance % (1000 * 60)) / 1000);
document.getElementById('timer').innerHTML =
days + 'd ' + hours + 'h ' + minutes + 'm ' + seconds + 's ';
if (distance < 0) {
clearInterval(x);
document.getElementById('timer').innerHTML = 'TIMER JUST EXPIRED!!!';
}
}, 1000);