因为hutool的maven依赖
fun ZonedDateTime.toLocalDateStr(): String =
DateTimeFormatter.ofPattern(DatePattern.CHINESE_DATE_PATTERN).format(this.withZoneSameInstant(ZoneId.of("UTC+8")))
val createdAt: ZonedDateTime = ZonedDateTime.now()
val createdAtStr = createdAt.toLocalDateStr()
本文介绍了如何使用Hutool的Maven依赖,通过ZonedDateTime实现从UTC+8时区到本地日期字符串的转换,并展示了ZonedDateTime.now()和DateTimeFormatter的用法。
734

被折叠的 条评论
为什么被折叠?



