我有这种格式的UTC时间2013-03-04T14:37:15
如何将此转换为当地时间,然后再转换为one minute ago
格式。隐藏UTC时间格式到当地时间
我想这首先将时间转换为本地格式:
private String getDate(String date) {
Date fDate = null;
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
try {
fDate = simpleDateFormat.parse(date);
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return fDate.toString();
}
但上述功能抛出一个异常,说无法解析的日期..
类似[转换UTC到当前区域设置的时间(http://stackoverflow.com/questions/6049207/convert-utc-to-current-locale-time)和[转换UTC日期到其他时区](http://stackoverflow.com/questions/6088778/converting-utc-dates-to-other-timezones) – McArthey 2013-03-19 16:40:14