我有一个以UTC格式表示的时间戳,我想将其转换为本地时间,但不使用像
示例输入值:
TimeZone.getTimeZone("PST")
这样的API调用。你应该如何做到这一点呢?我一直在尝试以下代码,但效果不佳:private static final SimpleDateFormat mSegmentStartTimeFormatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS");
Calendar calendar = Calendar.getInstance();
try {
calendar.setTime(mSegmentStartTimeFormatter.parse(startTime));
}
catch (ParseException e) {
e.printStackTrace();
}
return calendar.getTimeInMillis();
示例输入值:
[2012-08-15T22:56:02.038Z]
应返回等效的[2012-08-15T15:56:02.038Z]
。