timestamp-with-timezone

Java Convert GMT/UTC to Local time doesn't work as expected

99封情书 提交于 2019-11-26 06:00:37
问题 In Order to show a reproducible scenario, I am doing the following Get the current system time (local time) Convert Local time to UTC // Works Fine Till here Reverse the UTC time, back to local time. Followed 3 different approaches (listed below) but all the 3 approaches retains the time in UTC only. { long ts = System.currentTimeMillis(); Date localTime = new Date(ts); String format = \"yyyy/MM/dd HH:mm:ss\"; SimpleDateFormat sdf = new SimpleDateFormat (format); // Convert Local Time to UTC

Parse date without timezone javascript

Deadly 提交于 2019-11-26 05:50:38
问题 I want to parse date without timezone in JavaScript. I have tried: new Date(Date.parse(\"2005-07-08T00:00:00+0000\")); Returns Fri Jul 08 2005 02:00:00 GMT+0200 (Central European Daylight Time) new Date(Date.parse(\"2005-07-08 00:00:00 GMT+0000\")); Returns same result new Date(Date.parse(\"2005-07-08 00:00:00 GMT-0000\")); Returns same result I want to parse time: Without time zone. Without calling constructor Date.UTC or new Date(year, month, day). Just simple passing string into Date