Skip to content

Instantly share code, notes, and snippets.

@dancodery
Created June 30, 2016 14:02
Show Gist options
  • Save dancodery/16d9934f5f46b7c7c25ab3cad407be97 to your computer and use it in GitHub Desktop.
Save dancodery/16d9934f5f46b7c7c25ab3cad407be97 to your computer and use it in GitHub Desktop.
Website launch countdown in milliseconds. Counts down from a specific date in PHP and jQuery.
<div id="timer"></div>
<script>
var millis = <?php
$timestamp = strtotime('2020-07-30');// your launch date
$difference = $timestamp - time();// difference in seconds
echo ($difference * 1000); ?>;
function displaytimer(){
$('#timer').html(millis);
}
setInterval(function(){ // counts every millisecond down and updates
millis -= 1;
displaytimer();
}, 1);
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment