java.sql.Date To LocalDate - Java java.sql

Java examples for java.sql:Date

Description

java.sql.Date To LocalDate

Demo Code


//package com.java2s;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.ZoneId;

public class Main {
    public static LocalDate dateToLocalDate(java.sql.Date d) {
        return LocalDateTime.ofInstant(d.toInstant(),
                ZoneId.systemDefault()).toLocalDate();
    }//from   ww  w  . java2 s  .  c o m
}

Related Tutorials