Java Utililty Methods LocalDate to Date

List of utility methods to do LocalDate to Date

Description

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

Method

DatetoDate(LocalDate ld)
to Date
if (ld == null) {
    return null;
return Date.from(ld.atStartOfDay(UTC).toInstant());
DatetoDate(LocalDate ld)
to Date
Calendar c = Calendar.getInstance();
c.set(ld.getYear(), ld.getMonthValue() - 1, ld.getDayOfMonth());
Date dateNew = c.getTime();
return dateNew;
DatetoDate(LocalDate localDate)
to Date
return toDate(localDate.atStartOfDay());
DatetoDate(LocalDate localDate)
to Date
if (localDate == null) {
    return null;
Instant instant = localDate.atStartOfDay().atZone(ZoneId.systemDefault()).toInstant();
Date date = Date.from(instant);
return date;
DatetoDate(LocalDate localDate)
to Date
Preconditions.checkNotNull(localDate, "localDate should't be null");
return Date.from(localDate.atStartOfDay().atZone(ZoneId.systemDefault()).toInstant());
DatetoDate(LocalDate localDate)
to Date
if (localDate == null) {
    return null;
ZonedDateTime zonedDateTime = localDate.atStartOfDay(DEFAULT_ZONEID);
return Date.from(zonedDateTime.toInstant());
DatetoDate(LocalDate localDate)
to Date
Instant instant = localDate.atStartOfDay().toInstant(ZoneOffset.of("+0"));
return Date.from(instant);
DatetoUtilDate(LocalDate localDate)
to Util Date
if (localDate == null) {
    return null;
return toUtilDate(localDate.atTime(0, 0, 0, 0));