Java LocalDate to Date toDate(LocalDate localDate)

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

Description

to Date

Declaration

public static Date toDate(LocalDate localDate) 

Method Source Code


//package com.java2s;
import com.google.common.base.Preconditions;

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

public class Main {
    public static Date toDate(LocalDate localDate) {
        Preconditions.checkNotNull(localDate, "localDate should't be null");
        return Date.from(localDate.atStartOfDay().atZone(ZoneId.systemDefault()).toInstant());
    }/*from  w ww  . ja va 2  s. co m*/

    public static Date toDate(LocalDateTime localDateTime) {
        Preconditions.checkNotNull(localDateTime, "localDateTime should't not be null");
        return Date.from(localDateTime.atZone(ZoneId.systemDefault()).toInstant());
    }
}

Related

  1. toDate(LocalDate finalProjectDate, ZoneId zone)
  2. toDate(LocalDate ld)
  3. toDate(LocalDate ld)
  4. toDate(LocalDate localDate)
  5. toDate(LocalDate localDate)
  6. toDate(LocalDate localDate)
  7. toDate(LocalDate localDate)
  8. toUtilDate(LocalDate localDate)