Java LocalDate create from Date

Description

Java LocalDate create from Date

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

public class Main {
  public static void main(String[] argv) {
    LocalDate d = new Date().toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
    System.out.println(d);//  ww  w.  j  a  v a 2s  .  com
  }
}



PreviousNext

Related