Removed complicated math by just using time()

time() gives you the current epoch in seconds.

With this change you can also get rid of the javascript portion since you don't need the timezone

Also the indentation seems to be messed up.