localdate to date code example
Example 1: localdate to date java
// Localdate to Date
Date.from(localdate.atStartOfDay(ZoneId.systemDefault()).toInstant())
Example 2: date to localdate
dateToConvert.toInstant()
.atZone(ZoneId.systemDefault())
.toLocalDate();
Example 3: local date to date java
public LocalDate convertToLocalDateViaInstant(Date dateToConvert) {
return dateToConvert.toInstant()
.atZone(ZoneId.systemDefault())
.toLocalDate();
}