forked from Ujjawalmaurya/countdown
-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
35 lines (28 loc) · 916 Bytes
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
var rtc_end = new Date("2023-04-12T03:38:00Z");
function loadData() {
document.getElementById('rtc').innerHTML = rtc_end;
}
// ! Function
function newYear() {
var now = new Date().getTime();
gap = rtc_end - now;
// var ms = 100;
var second = 10 * 100;
var minute = second * 60;
var hour = minute * 60;
var day = hour * 24;
var d = Math.floor(gap / (day));
var h = Math.floor((gap % (day)) / hour);
var m = Math.floor((gap % (hour)) / minute);
var s = Math.floor((gap % (minute)) / second);
// var ms = Math.floor((gap % (second)) / ms);
document.getElementById('day').innerText = d;
document.getElementById('hour').innerText = h;
document.getElementById('minute').innerText = m;
document.getElementById('second').innerText = s;
// document.getElemetsById('ms').innerText = ms;
}
// ! Counter
setInterval(function(){
newYear()
},1000)