我有一个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]
等效的
https://stackoverflow.com/questions/12487125
复制相似问题