Skip to content Skip to sidebar Skip to footer

Question About Time Functions In Php And Javascript Particularly The Gettime Function Of Javascript

I have a problem in my code, it seems like PHP and Javascript is returning different Unix Epoch time.. My code in Javascript is this: day = 13; month = 4; year = 2011; hour = 15; m

Solution 1:

Apparently Javascript returns the given time in milliseconds, while PHP gives seconds only.

Edit: so to answer your question, I think you should divide the time you get in JS by 1000, because it will always be divisible with 1000, since the smallest unit you set in your code example is in minutes.

Solution 2:

javascript returns milliseconds, and php - seconds

Solution 3:

Judging by the factor 1000, I’d say Javascript counts the number of milliseconds, whereas PHP counts the number of seconds...

Post a Comment for "Question About Time Functions In Php And Javascript Particularly The Gettime Function Of Javascript"