Java SQL LocalDate 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.sql.Date;

import java.time.LocalDate;
import java.time.LocalDateTime;

import java.time.ZoneOffset;

public class Main {
    public static LocalDate toLocalDate(Date date) {
        if (date == null) {
            return null;
        }/*ww  w  .jav a  2 s.c om*/
        LocalDateTime ldt = LocalDateTime.ofInstant(new java.util.Date(date.getTime()).toInstant(),
                ZoneOffset.systemDefault());
        return ldt.toLocalDate();
    }
}

Related

  1. toDate(LocalDate localDate)
  2. toDate(LocalDate localDate)
  3. toInstant(Date date)
  4. toJavaDate(DateMidnight dm)
  5. toJDBC(LocalDate fecha)
  6. toLocalDate(Date date)
  7. toLocalDate(final Date d)
  8. toLocalDate(java.sql.Date date)
  9. toLocalDate(java.util.Date d)