UTC时间转为正常日期

SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'", Locale.US);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
sf.setTimeZone(TimeZone.getTimeZone("UTC"));
Date date = null;
String dateTime = "";
String utcTime = "2018-08-07T01:00:59Z";
try {
date = sf.parse(utcTime);
dateTime = sdf.format(date);
System.out.println(dateTime);
} catch (ParseException e) {
e.printStackTrace();
}
原文地址:https://www.cnblogs.com/leigepython/p/10689767.html