date to local date java code example
Example 1: localdate to date java
// Localdate to Date
Date.from(localdate.atStartOfDay(ZoneId.systemDefault()).toInstant())
Example 2: how to turna date into a LocalDateTime java
public LocalDateTime convertToLocalDateTimeViaInstant(Date dateToConvert) {
return dateToConvert.toInstant()
.atZone(ZoneId.systemDefault())
.toLocalDateTime();
}