Java LocalDate to Date date(LocalDate d, ZoneId zone)

Here you can find the source of date(LocalDate d, ZoneId zone)

Description

date

License

Open Source License

Declaration

public static Date date(LocalDate d, ZoneId zone) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

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

public class Main {
    public static Date date(int year, int month, int date) {
        return date(year, month, date, ZoneId.systemDefault());
    }//from  www  .jav a  2 s  .c  o  m

    public static Date date(int year, int month, int date, ZoneId zone) {
        return date(year, month, date, 0, 0, zone);
    }

    public static Date date(int year, int month, int date, int hour, int min) {
        return date(year, month, date, hour, min, ZoneId.systemDefault());
    }

    public static Date date(int year, int month, int date, int hour, int min, ZoneId zone) {
        return Date.from(ZonedDateTime.of(year, month, date, hour, min, 0, 0, zone).toInstant());
    }

    public static Date date(LocalDate d, ZoneId zone) {
        return Date.from(d.atStartOfDay().atZone(zone).toInstant());
    }
}

Related

  1. convertToDate(LocalDate localDate)
  2. date(LocalDate date)
  3. date(LocalDate date)
  4. date(LocalDate date)
  5. localDateToDate(LocalDate date)