Created
April 23, 2015 08:48
-
-
Save cyang-el/77c7ccf6d4c092de4010 to your computer and use it in GitHub Desktop.
this year's santa ETA countdown
This file contains 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
<!DOCTYPE html> | |
<html> | |
<body> | |
<p>Time before santa comes:</p> | |
<div class="countdown"></div> | |
<script src="http://cdnjs.cloudflare.com/ajax/libs/moment.js/2.5.0/moment.min.js"></script> | |
<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> | |
<script type="text/javascript"> | |
var myVar=setInterval(function(){showtime()},1000); | |
function showtime() | |
{ | |
var m = moment("2015-12-24 23:59:59", "YYYY-MM-DD HH:mm:ss");//this is the countdown anchor | |
var now = moment(); | |
var d = moment.duration(m - now); | |
// build your output string | |
var s = d.years() + " years, " + | |
d.months() + " months, " + | |
d.days() + " days, " + | |
d.hours() + " hours, " + | |
d.minutes() + " minutes, and " + | |
d.seconds() + " seconds"; | |
$('.countdown').text(s); | |
} | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment