code:
<html>
<head>
<title>Timer</title>
</head>
<body>
<?php
$dbSessionDuration = "1:30:00";
list($hour,$min,$sec) = explode(':', $dbSessionDuration);
$dbSessionDurationTime = mktime(0,0,0,$hour,$min,$sec);
?>
<div class="count"></div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script type="text/javascript">
var millis = <?php echo $dbSessionDurationTime; ?>
function displaytimer(){
var hours = Math.floor(millis / 36e5),
mins = Math.floor((millis % 36e5) / 6e4),
secs = Math.floor((millis % 6e4) / 1000);
$('.count').html(hours+':'+mins+':'+secs);
}
setInterval(function(){
millis -= 1000;
displaytimer();
}, 1000);
</script>
</body>
</html>
In this code I want to create a timer and the time will start after 1:30:00
and then it decrease by second like 1:29:59
then 1:29:58
like this but now when I use to get time inside the class="count"
not happen. I don't know why? So, How can I fix this issue? please help me.
Thank You