I'm writing javascript multiplayer game, my server code is in nodejs. I need to synchronize time between server and client.
At server side i call Date() and send the date string to client. Client recieves:
Tue Apr 28 2015 15:37:01 GMT+0000 (UTC)
After initialization with:
var time = Date("Tue Apr 28 2015 15:37:01 GMT+0000 (UTC)");
the time variable set to local time is:
Tue Apr 28 2015 17:37:03 GMT+0200 (CEST).
If i run my server localy then time is importing correctly. Is problem in different time format, CEST vs UTC ?
Thank you for answers
timehas no format. Only when you show (stringify) it, it will use the local timezone for formatting the string. If you explicitly usetime.toUTCString(), it won't.