-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
29 lines (25 loc) · 943 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
const targetDate = new Date("2026-07-01 00:00:00").getTime(); // Set your target date and time
function updateTimer() {
const now = new Date().getTime();
const timeRemaining = targetDate - now;
const days = Math.floor(timeRemaining / (1000 * 60 * 60 * 24));
const hours = Math.floor(
(timeRemaining % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)
);
const minutes = Math.floor((timeRemaining % (1000 * 60 * 60)) / (1000 * 60));
const seconds = Math.floor((timeRemaining % (1000 * 60)) / 1000);
document.getElementById("days").textContent = days
.toString()
.padStart(2, "0");
document.getElementById("hours").textContent = hours
.toString()
.padStart(2, "0");
document.getElementById("minutes").textContent = minutes
.toString()
.padStart(2, "0");
document.getElementById("seconds").textContent = seconds
.toString()
.padStart(2, "0");
}
updateTimer();
setInterval(updateTimer, 1000);