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


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


import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.Date;
//from w  w w  . j av a 2s .  co m
public class Main {

  public static void main(String[] args) {
    LocalDateTime now =;
    Instant instant = now.atZone(ZoneId.systemDefault()).toInstant();
    Date dateFromOld = Date.from(instant);

The code above generates the following result.