Created
February 9, 2021 14:53
-
-
Save kybernetikos/2fb7f6cb00ebed6fd9b2cb62fccb2772 to your computer and use it in GitHub Desktop.
Calculate Age in Minutes
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
<html> | |
<head> | |
<style> | |
body { | |
background-color: turquoise; | |
} | |
#age { | |
color: white; | |
font-size: xxx-large; | |
font-family: sans-serif; | |
margin: 100px; | |
} | |
</style> | |
</head> | |
<body> | |
<div id="age" /> | |
<script> | |
const placeToShowAge = document.getElementById('age') | |
const myBirth = new Date('2010-12-05T17:00:00') | |
setInterval(() => { | |
placeToShowAge.innerText = Math.floor((Date.now() - myBirth.getTime()) / 1000 / 60).toLocaleString() | |
}, 250) | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment