Start timer in javascript
<script>
$(document).ready(function () {
CountDown();
})
function CountDown() {
var tt ="23-Mar-22 10:26:34 AM";
if (tt == null || tt == "") {
$('#demo').show();
document.getElementById("demo").innerHTML = "YOUR ID IS NOT ACTIVATED";
return;
}
var countDownDate = new Date('23-Mar-22 10:26:34 AM').getTime();
var x = setInterval(function () {
//debugger;
var now = new Date().getTime();
var distance = countDownDate - now;
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);
$('#demo').show();
document.getElementById("demo").innerHTML = "YOUR ID WILL BE EXPIRE IN " + days + " Day " + hours + "h "
+ minutes + "m " + seconds + "s ";
if (distance < 0) {
clearInterval(x);
document.getElementById("demo").innerHTML = "YOUR ID IS EXPIRED";
}
}, 1000);
}
</script>
No comments:
Post a Comment