forked from snowsanta/snowsanta.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcount-down.js
More file actions
25 lines (19 loc) · 917 Bytes
/
count-down.js
File metadata and controls
25 lines (19 loc) · 917 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
// Set the date we're counting down to
var countDownDate = new Date("Apr 4, 2020 12:00:00").getTime();
// Update the count down every 1 second
var x = setInterval(function() {
// Get today's date and time
var now = new Date().getTime();
// Find the distance between now and the count down date
var distance = countDownDate - now;
// Time calculations for days, hours, minutes and seconds
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 daycontainer=document.getElementById("days")
var hourcontainer=document.getElementById("hours")
var mincontainer=document.getElementById("mins")
daycontainer.innerHTML=days + "<br>Days"
hourcontainer.innerHTML=hours + "<br>Hours"
mincontainer.innerHTML=minutes + "<br>Mins"
},100)