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