Skip to content

Instantly share code, notes, and snippets.

@kybernetikos
Created February 9, 2021 14:53
Show Gist options
  • Save kybernetikos/2fb7f6cb00ebed6fd9b2cb62fccb2772 to your computer and use it in GitHub Desktop.
Save kybernetikos/2fb7f6cb00ebed6fd9b2cb62fccb2772 to your computer and use it in GitHub Desktop.
Calculate Age in Minutes
<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