Java LocalDate to Date toDate(final LocalDate localDate)

Here you can find the source of toDate(final LocalDate localDate)

Description

Converts local date to Date.

License

Open Source License

Declaration

public static Date toDate(final LocalDate localDate) 

Method Source Code

//package com.java2s;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.ZoneId;

import java.util.Date;

public class Main {
    /**//from   w  w  w  . j  a v  a  2 s  .co  m
     * Converts local date to Date.
     */
    public static Date toDate(final LocalDate localDate) {
        return Date.from(localDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
    }

    /**
     * Converts local date time to Date.
     */
    public static Date toDate(final LocalDateTime localDateTime) {
        return Date.from(localDateTime.atZone(ZoneId.systemDefault()).toInstant());
    }
}

Related

  1. date(LocalDate date)
  2. date(LocalDate date)
  3. date(LocalDate date)
  4. localDateToDate(LocalDate date)
  5. localDateToDate(LocalDate ld)
  6. toDate(LocalDate date)
  7. toDate(LocalDate finalProjectDate, ZoneId zone)
  8. toDate(LocalDate ld)
  9. toDate(LocalDate ld)