nanosecond cooler

This commit is contained in:
Boof 2023-06-09 11:51:33 +02:00 committed by GitHub
parent 890009e58b
commit 8812398b31
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 4 deletions

View File

@ -22,7 +22,7 @@
</div>
<br>
<div>
<p>Want to know how old you are in millieseconds? <a href="ms.html">Go here</a></p>
<p>Want to know how old you are in nanoseconds? <a href="ms.html">Go here</a></p>
<h3>What day was my birthday Jun 8, 2009?</h3>
<p>June 8, 2009 was a Monday and it was the 159th day of the year 2009. It was the 23rd Monday of that year. The
next time you can reuse your old 2009 calendar will be in 2026. Both calendars will be exactly the same!

View File

@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>How old are you in millieseconds?</title>
<title>How old are you in nanoseconds?</title>
<script src="ms.js"></script>
</head>
<body>

5
ms.js
View File

@ -2,8 +2,9 @@ function calculateYearsSince() {
const myDate = new Date('2009-06-08');
const diffInMs = Date.now() - myDate.getTime();
document.getElementById("number").innerText = diffInMs
const diffInNs = diffInMs * 1000000
document.getElementById("number").innerText = diffInNs
}
setInterval(calculateYearsSince, 0.1)