Java Data Type How to - Create a LocalDateTime as 1491, Month.JUNE, 28th, hour 13, minute 51








Question

We would like to know how to create a LocalDateTime as 1491, Month.JUNE, 28th, hour 13, minute 51.

Answer

//  w w  w.j a  v  a2 s.  c om
import java.time.LocalDateTime;
import java.time.Month;

public class Main {
  public static void main(String[] argv) {
    LocalDateTime d =  LocalDateTime.of(1491, Month.JUNE, 28, 13, 51);
    System.out.println(d);
  }
}

The code above generates the following result.