date to localdate injava 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 convertToLocalDateTimeViaMilisecond(Date dateToConvert) {
return Instant.ofEpochMilli(dateToConvert.getTime())
.atZone(ZoneId.systemDefault())
.toLocalDateTime();
}