Java LocalDate Create toLocalDate(final Date date)

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

Description

to Local Date

License

Open Source License

Declaration

public static LocalDate toLocalDate(final Date date) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.text.SimpleDateFormat;
import java.time.LocalDate;

import java.util.Date;

public class Main {
    public static LocalDate toLocalDate(final Date date) {
        if (date == null) {
            return null;
        } else {//from  w  ww .  ja v  a  2 s  .  c om
            String str = new SimpleDateFormat("yyyy-MM-dd").format(date);
            return LocalDate.parse(str);
        }
    }
}

Related

  1. getCurrentLocalDate()
  2. getLocalDate(int year, int atDay)
  3. getLocalDate(java.util.Date date)
  4. getLocalDate(long timeInMillis)
  5. toLocalDate(Calendar calendar)