From c7c534d418c62e7499f0bb404a36457c7fc339c1 Mon Sep 17 00:00:00 2001 From: Boof <97455552+hexahigh@users.noreply.github.com> Date: Fri, 9 Jun 2023 11:46:20 +0200 Subject: [PATCH] added age in millieseconds --- index.html | 1 + ms.html | 11 +++++++++++ ms.js | 15 +++++++++++++++ 3 files changed, 27 insertions(+) create mode 100644 ms.html create mode 100644 ms.js diff --git a/index.html b/index.html index 1a0a2e5..9069132 100644 --- a/index.html +++ b/index.html @@ -22,6 +22,7 @@
+

Want to know how old you are in millieseconds? Go here

What day was my birthday Jun 8, 2009?

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! diff --git a/ms.html b/ms.html new file mode 100644 index 0000000..f8e9fbb --- /dev/null +++ b/ms.html @@ -0,0 +1,11 @@ + + + + + + How old are you in millieseconds? + + +

+ + \ No newline at end of file diff --git a/ms.js b/ms.js new file mode 100644 index 0000000..e0e8f2e --- /dev/null +++ b/ms.js @@ -0,0 +1,15 @@ +function calculateYearsSince() { + const myDate = new Date('2009-06-08'); + + const diffInMs = Date.now() - myDate.getTime(); + const diffInYears = diffInMs / (1000 * 60 * 60 * 24 * 365.25); + const days = Math.floor(diffInMs / (1000 * 60 * 60 * 24)); + const hours = Math.floor(hoursSince()) + const minutes = Math.floor(diffInMs / 1000 / 60) + //const hours = Math.floor((diffInMs % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); + //const minutes = Math.floor((diffInMs % (1000 * 60 * 60)) / (1000 * 60)); + + document.getElementById("number").innerText = diffInMs +} + +setInterval(calculateYearsSince, 0.1) \ No newline at end of file