java kotlin解析2018-12-28T09:17:30.875+0000这种类型的时间
程序员文章站
2022-04-07 21:00:31
...
fun praseTime(time: String): String {
val df = SimpleDateFormat("yyyy-MM-dd'T'hh:mm:ss.SSSZ", Locale.CHINA)
val result: Date
result = df.parse(time)
val sdf = SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.CHINA)
sdf.timeZone = TimeZone.getTimeZone("GMT")
return sdf.format(result)
}