Skip to content

Instantly share code, notes, and snippets.

@Rameshwar-ghodke
Created January 7, 2021 05:09
Show Gist options
  • Save Rameshwar-ghodke/66b90519bc964c3507f9afc1f8744532 to your computer and use it in GitHub Desktop.
Save Rameshwar-ghodke/66b90519bc964c3507f9afc1f8744532 to your computer and use it in GitHub Desktop.
Display number of count days , it will automatic reduce one by one days
<span class="count_days" id='remain_days'> </span>
<script>
var countDownDate = new Date("Feb 15, 2021").getTime();
var x = setInterval(function() {
var now = new Date().getTime();
var distance = countDownDate - now;
var days = Math.floor(distance / (1000 * 60 * 60 * 24));
document.getElementById("remain_days").innerHTML = days;
if (distance < 0) {
clearInterval(x);
document.getElementById("remain_days").innerHTML = "Update Soon..";
}
}, 1000);
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment