1. Date to LocalDateTime/LocalDate
public static void main(String[] args) {
Date date = new Date();
LocalDateTime localDateTime = LocalDateTime.ofInstant(date.toInstant(), ZoneId.systemDefault());
LocalDate localDate = localDateTime.toLocalDate();
}
2. LocalDate/LocalDateTime to Date
public static void main(String[] args) {
LocalDateTime localDateTime = LocalDateTime.now();
LocalDate localDate = localDateTime.toLocalDate();
Date date = Date.from(localDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
}