1dateToConvert.toInstant()
2 .atZone(ZoneId.systemDefault())
3 .toLocalDate();
1import java.time.LocalDate;
2import java.time.LocalDateTime;
3
4public class Main {
5 public static void main(String[] args) {
6
7 LocalDateTime localDateTime = LocalDateTime.now();
8
9 LocalDate localDate = localDateTime.toLocalDate();
10
11 System.out.println(localDate);
12 }
13}
14
1public LocalDate convertToLocalDateViaInstant(Date dateToConvert) {
2 return dateToConvert.toInstant()
3 .atZone(ZoneId.systemDefault())
4 .toLocalDate();
5}