Open bobby-walle opened 6 years ago
大神的UTC时间转换太暴力了,可以这样 @Nullable public static String subStandardTime(String time) throws ParseException { SimpleDateFormat formatUTC = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS Z"); Date date = formatUTC.parse(time.replace("Z", " UTC")); SimpleDateFormat formatGST = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); return formatGST.format(date); }
@Nullable
public static String subStandardTime(String time) throws ParseException {
SimpleDateFormat formatUTC = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS Z");
Date date = formatUTC.parse(time.replace("Z", " UTC"));
SimpleDateFormat formatGST = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
return formatGST.format(date);
}
大神的UTC时间转换太暴力了,可以这样
@Nullable
public static String subStandardTime(String time) throws ParseException {
SimpleDateFormat formatUTC = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS Z");
Date date = formatUTC.parse(time.replace("Z", " UTC"));
SimpleDateFormat formatGST = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
return formatGST.format(date);
}