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


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


import java.time.LocalDate;
import java.time.ZoneOffset;
import java.util.Date;
//from   w w w .  j  av  a  2s .com
public class Main {

  public static void main(String[] args) {
    System.out.println(fromLocalDateIn(, ZoneOffset.UTC));

  public static Date fromLocalDateIn(LocalDate date, ZoneOffset timeZone) {
    return Date.from(date.atStartOfDay().toInstant(timeZone));

The code above generates the following result.