codeestX / GeekNews

:books:A pure reading App based on Material Design + MVP + RxJava2 + Retrofit + Dagger2 + Realm + Glide
3.5k stars 826 forks source link

UTC时间转换错误 #127

Open bobby-walle opened 6 years ago

bobby-walle commented 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); }