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

如何将jodatime的DateTime转换为java的LocalDateTime,java,jodatime,localdate,Java,Jodatime,Localdate,我试过这个: 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.ZoneI

我试过这个:

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)
这项工作:

LocalDateTime.ofInstant(Instant.ofEpochMilli(startDateTime.getMillis()), ZoneId.systemDefault()))

检查您的导入。