如何将jodatime的DateTime转换为Java的LocalDateTime

问题描述 投票:-2回答:1

我尝试过:

LocalDateTime.ofInstant(dateTime.toInstant(), ZoneId.systemDefault()))

但是它给出了编译时错误:

The method ofInstant(java.time.Instant, java.time.ZoneId) in the type LocalDateTime is not applicable for the arguments (org.joda.time.Instant, java.time.ZoneId)
java jodatime localdate
1个回答
0
投票

此作品:

LocalDateTime.ofInstant(Instant.ofEpochMilli(startDateTime.getMillis()), ZoneId.systemDefault()))
© www.soinside.com 2019 - 2024. All rights reserved.