Created
January 1, 2020 00:13
-
-
Save zombiepigdragon/20dc7ec9fca1a3e7502596aabc77e8bf to your computer and use it in GitHub Desktop.
Countdown to 2020!
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> | |
<head> | |
<title>Countdown to 2020</title> | |
<script> | |
setInterval(function() { | |
var destTime = new Date(2020, 0, 0, 24, 0, 0, 0); | |
var currentTime = new Date(); | |
var nextTime = new Date(destTime - currentTime); | |
console.log(currentTime); | |
console.log(destTime); | |
console.log(nextTime); | |
document.getElementById("timeleft").innerText = Math.floor(nextTime.getTime() / (1000 * 60 * 60)) + " hours, " + Math.floor(nextTime.getTime() / (1000 * 60) % 60) + " minutes, and " + Math.floor((nextTime.getTime() / 1000) % 60) + " seconds" | |
}, 10); | |
</script> | |
<style> | |
html, body, .container { | |
height: 99%; | |
background-color: black; | |
} | |
.container { | |
display: -webkit-flexbox; | |
display: -ms-flexbox; | |
display: -webkit-flex; | |
display: flex; | |
-webkit-flex-align: center; | |
-ms-flex-align: center; | |
-webkit-align-items: center; | |
align-items: center; | |
justify-content: center; | |
color: white; | |
} | |
#timeleft { | |
color: skyblue; | |
} | |
</style> | |
</head> | |
<body> | |
<div class="container"> | |
<h1>I hate when people ask what I'm doing in <span id="timeleft"></span>, I don't have 2020 vision</h1> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment