javascript countdown from date code example

Example 1: javascript countdown 10 seconds

var timeleft = 10;
var downloadTimer = setInterval(function(){
  if(timeleft <= 0){
    clearInterval(downloadTimer);
  }
  document.getElementById("progressBar").value = 10 - timeleft;
  timeleft -= 1;
}, 1000);
<progress value="0" max="10" id="progressBar"></progress>

Example 2: countdown in js

<body>
    <div>Registration closes in <span id="time">05:00</span> minutes!</div>
</body>

Tags:

Php Example