Skip to content

Instantly share code, notes, and snippets.

@bikashthapa01
Created April 17, 2020 10:46
Show Gist options
  • Select an option

  • Save bikashthapa01/dc280e491d301c2fdc8d8ef1bb96e51c to your computer and use it in GitHub Desktop.

Select an option

Save bikashthapa01/dc280e491d301c2fdc8d8ef1bb96e51c to your computer and use it in GitHub Desktop.
<script type="text/javascript">
setInterval("my_function('2020-04-17T18:30:00Z');",1000);
function my_function(time){
var future = Date.parse(time)/1000;
var now = Date.now()/1000;
var totalRem = future - now;
var days = Math.floor(totalRem/86400);
var hours = Math.floor((totalRem%86400)/3600);
var minutes = Math.floor(((totalRem%86400)%3600)/60);
var seconds = Math.floor(((totalRem%86400)%3600)%60)
document.getElementById('time').innerHTML = days+" Days "+hours+" hours "+minutes+" Minutes and " + seconds + " seconds.";
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment