I have a countdown system set up in my project where a user enters by hours how long they want to reserve something for. i.e)1,2,3,4 hours etc. Then a countdown timer starts and notifies them when it is done. I found a really good one online however it is giving the countdown only in relation to seconds remaining. I am wondering if anyone knows how to manipulate this code to show hrs:minutes remaining.
I already tried the w3schools one however that won't work as that is in terms of an actual given future time
<!-- $_row["Time"] returns the number of hours hence must multiply by 3600 to get it in terms of seconds for this example to work -->
<?php $remain= $_row["Time"] * 3600; ?>
<script>
function countDown(secs,elem) {
var element = document.getElementById(elem);
element.innerHTML = "Time Remaining "+secs+" seconds";
if(secs < 1) {
clearTimeout(timer);
element.innerHTML = '<h2>Your Time is up!</h2>';
element.innerHTML += '<p>Please evacuate the parking space as soon as possible</p><br>';
element.innerHTML += '<a href="Home.php">Return to Home</a>';
}
secs--;
var timer = setTimeout('countDown('+secs+',"'+elem+'")',1000);
}
</script>
<div id="status"></div>
<script>countDown(<?php echo $remain ?>,"status");</script>