我有一个显示Mountain时区的字符串“2014-07-02T17:12:36.488-01:00”。我将其解析为java.util.date格式。现在我需要将其转换为GMT格式。谁能帮我??如何将java.util.Date转换为GMT格式
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
Object dd = null;
try {
dd=sdf.parseObject("2014-07-02T17:12:36.488-01:00");
System.out.println(dd);
} catch (ParseException e) {
e.printStackTrace();`enter code here`
}
SimpleDateFormat gmtDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
gmtDateFormat.setTimeZone(java.util.TimeZone.getTimeZone("GMT"));
System.out.println("Current Date and Time in GMT time zone:+ gmtDateFormat.format(dd));
[转换符合ISO8601字符串到java.util.Date](可能重复http://stackoverflow.com/questions/2201925/converting-iso8601-compliant-string-to-java- util-date) –