fun main() { val formatPattern = "yyyy-MM-dd HH:mm:ss" val utc = "2019-07-10T16:00:00.000Z" val time = parse(utc, formatPattern) println(time) } fun parse(utc: String, formatPattern: String): String { val zdt = ZonedDateTime.parse(utc) val ldt = zdt.toLocalDateTime() val formatter = DateTimeFormatter.ofPattern(formatPattern) return formatter.format(ldt.plusHours(8)) }
暂无评论