I'm currently working on a way to incorporate the results of this online timer script into another script. Below is the timer script that I came across:
// Setting the target date for the countdown
var countDownDate = new Date("Jan 5, 2022 15:37:25").getTime();
// Updating the countdown every second
var x = setInterval(function() {
// Getting today's date and time
var now = new Date().getTime();
// Calculating the time remaining until the deadline
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 seconds = Math.floor((distance % (1000 * 60)) / 1000);
// Displaying the timer result in an element with id="demo"
document.getElementById("demo").innerHTML = days + "d " + hours + "h "
+ minutes + "m " + seconds + "s ";
// If the countdown is over, display a message
if (distance < 0) {
clearInterval(x);
document.getElementById("demo").innerHTML = "EXPIRED";
}
}, 1000);
<!-- Showing the countdown timer within an element -->
<p id="demo"></p>
I am looking to integrate the timer where it says "I want to display the timer here".
<div class="flash-infos">
<div class="flash-info">
<font color="white"; font size = 2; ><b>"I want to display the timer here"</b></font> <center>
</div>
</div>