Date类转Java8新时间类看这一篇就够了,Date转LocalDate,LocalTime,LocalDateTime,ZonedDateTime,OffsetDateTime方法大全!
Date转Java8新时间类1.Date转LocalDate:LocalDate表示日期,不包含时间和时区信息,例如"2022-04-22"。1.使用java.util.Date的toInstant()方法将Date对象转换为Instant对象,再使用Instant对象的atZone()方法将其转换为ZonedDateTime对象,最后使用ZonedDateTime对象的toLocalDate()