Created
June 30, 2016 14:02
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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