Java LocalDate from Date toLocalDate(Date date)

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

Description

to Local Date

License

Apache License

Declaration

public static LocalDate toLocalDate(Date date) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

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

public class Main {
    public static LocalDate toLocalDate(Date date) {
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(date);//  w w w  .j a v a 2  s  . c  om
        LocalDate localeData = LocalDate.of(calendar.get(Calendar.YEAR),
                calendar.get(Calendar.MONTH),
                calendar.get(Calendar.DAY_OF_MONTH));
        return localeData;
    }
}

Related

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