So, let's say a user launches my web application from his browser in a different time zone than the application server. I am serializing the date on the client side using the date.getTime() JavaScript method. I send the received milliseconds via Json and then create a server-side Java Date object by calling new Date(millisecondsFromJS) . I save this to MySql, retrieve it, serialize it again, calling Java date.getTime() and sending it again to the client via Json.
If I create a JavaScript Date object with these milliseconds, will this lead to the original date? I have successfully completed this process, but the client and server are currently in the same time zone. I'm not sure if the date will be damaged in the process if the time zones are different.
As I understand it, using getTime () returns a point in time that is independent of time zones. If the user captured the CDT on July 17, 2012 at 4:39 pm, the server can save it as July 17, 2012 at 11:39 pm CEST, for example, but as soon as the server converts this to milliseconds from GMT, and the client creates a date from these milliseconds , he would have successfully restored the original on July 17, 2012 at 4:39 pm CDT. It's true?
java javascript date
Jaypea
source share