Skip to content

Instantly share code, notes, and snippets.

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