Java Utililty Methods LocalDate from Date

List of utility methods to do LocalDate from Date

Description

The list of methods to do LocalDate from Date are organized into topic(s).

Method

LocalDatetoLocalDate(Date calendar)
to Local Date
return Instant.ofEpochMilli(calendar.getTime()).atZone(ZoneId.systemDefault()).toLocalDate();
LocalDatetoLocalDate(Date date)
to Local Date
Preconditions.checkNotNull(date, "Date should't be null");
return Instant.ofEpochMilli(date.getTime()).atZone(ZoneId.systemDefault()).toLocalDate();
LocalDatetoLocalDate(Date date)
to Local Date
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
LocalDate localeData = LocalDate.of(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH),
        calendar.get(Calendar.DAY_OF_MONTH));
return localeData;
LocalDatetoLocalDate(Date date)
to Local Date
return LocalDate.from(date.toInstant());