The popular xkcd comic put this equation for converting time to date:

I am trying to do the same in JavaScript, although I keep getting -Infinity. Here is the code:
var p = 5;
var today = new Date();
today = today.getTime();
var t;
t = (today) - (Math.pow(Math.E, (20.3444 * Math.pow(p,3))) -
Math.pow(Math.E,3));
document.write(t + " years");
Time will return a huge amount (milliseconds), and I know that the equation is not designed to work with milliseconds - so how could you use the advanced date equation with JavaScript?
source
share