<分区>
我有一个格式为 2013-03-04T14:37:15
的 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();
}
但是上面的函数抛出一个异常说无法解析的日期..