-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
28 lines (21 loc) · 891 Bytes
/
app.js
File metadata and controls
28 lines (21 loc) · 891 Bytes
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
function countdown(){
const future = new Date("October 29, 2021, 00:00:00").getTime();
const now = new Date().getTime();
var gap = future - now;
// How time works
const seconds = 1000;
const minute = seconds * 60;
const hour = minute * 60;
const day = hour * 24;
// Getting the countdown values
const textDay = Math.floor(gap / day);
const textHour = Math.floor((gap % day) / hour);
const textminute = Math.floor((gap % hour) / minute);
const textsecond = Math.floor((gap % minute) / seconds);
// Putting our values into the HTML file
document.querySelector('.time-day').innerText = textDay;
document.querySelector('.time-hour').innerText = textHour;
document.querySelector('.time-minute').innerText = textminute;
document.querySelector('.time-seconds').innerText = textsecond;
}
setInterval(countdown, 1000);