I have a JavaScript Date object,Thu Jul 02 2015 00:00:00 GMT-0400 (Eastern Standard Time)
, which is passed to a Java method that stores this date in a Java Date object. But the Java date object shows this date as Wed Jul 01 23:00:00 CDT 2015
. How can I get the correct conversion from JavaScript Date to Java Date?
Note: This only happens when i have my PC set to Eastern Standard Time and the clock is set to around 9 AM. Other than that, if i set my PC's timezone back to Central Standard Time, then this is no longer an issue.
Update
The number of milliseconds from the epoch to 07/02/15 is 1435809600000. If I take these milliseconds and create a JS Date object like so, new Date(1435809600000)
, I get this: Thu Jul 02 2015 00:00:00 GMT-0400 (Eastern Standard Time). But when i try to create a Java Date object, new Date(1435809600000)
, I get: Wed Jul 01 23:00:00 CDT 2015