Java - Convert From A Timezone Different From Local To UTC
问题 So from all the posts I read about this issue (for example, Convert timestamp to UTC timezone). I learn that a way to do this conversion is : SimpleDateFormat dfmaputo = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss a"); dfmaputo.setTimeZone(TimeZone.getTimeZone("UTC")); long unixtime = dfmaputo.parse(data.get(1)).getTime(); unixtime = unixtime / 1000; output: original date (Maputo Timezone) -- 11/5/2015 1:39:45 PM unix timestamp in UTC --- 1446687585 data.get(1) is the string with the maputo