java.util. to LocalDate - Java java.time

Java examples for java.time:LocalDate

Description

java.util. to LocalDate

Demo Code


//package com.java2s;
import java.time.Instant;
import java.time.LocalDate;
import java.util.Date;
import static java.time.LocalDateTime.ofInstant;
import static java.time.ZoneId.systemDefault;

public class Main {
    public static LocalDate toLocalDate(Date date) {
        Instant instant = Instant.ofEpochMilli((date).getTime());
        return ofInstant(instant, systemDefault()).toLocalDate();
    }//from   ww w .ja va  2s  . c  o  m
}

Related Tutorials