runthis Posted January 3, 2012 Share Posted January 3, 2012 Ok, so my question is this. How can i convert a php timestamp time() to javascripts new Date function. The reason is because, new Date gives the users time. Php gives the server time. The server time is what i want. I understand i could rewrite my entire timing system in javascript to the timezone the server is in, but maybe you know the way without rewriting my javascript functions completely when the server changes Quote Link to comment Share on other sites More sharing options...
bineye Posted January 3, 2012 Share Posted January 3, 2012 ok why is the time * 1000? does the JS need this for it to work? Quote Link to comment Share on other sites More sharing options...
bluegman991 Posted January 4, 2012 Share Posted January 4, 2012 Javascript time is in microseconds. Php time defaults to seconds. If you want to be more accurate you can use microtime(true)*1000. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.