Java LocalDate from Date toLocalDate(Date date)

Here you can find the source of toLocalDate(Date date)

Description

to Local Date

Declaration

public static LocalDate toLocalDate(Date date) 

Method Source Code


//package com.java2s;
import com.google.common.base.Preconditions;
import java.time.Instant;
import java.time.LocalDate;

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

public class Main {
    public static LocalDate toLocalDate(Date date) {
        Preconditions.checkNotNull(date, "Date should't be null");
        return Instant.ofEpochMilli(date.getTime()).atZone(ZoneId.systemDefault()).toLocalDate();
    }/*from   w w w .  j  a  va 2  s. c  om*/
}

Related

  1. toLocalDate(Date calendar)
  2. toLocalDate(Date date)
  3. toLocalDate(Date date)