Java Data Type How to - Convert LocalDate to java.util.Date


We would like to know how to convert LocalDate to java.util.Date.


import java.time.Instant;
import java.time.LocalDate;
import java.time.ZoneId;
import java.util.Date;
/*from   w w w  .ja va2s.  c o  m*/
public class Main {

  public static void main(String[] args) {

  public static Date fromLocalDate(LocalDate date) {
    Instant instant = date.atStartOfDay().atZone(ZoneId.systemDefault())
    return Date.from(instant);

The code above generates the following result.