Java SQL Date convert to LocalDate

Description

Java SQL Date convert to LocalDate

import java.sql.Date;
import java.time.LocalDate;


public class Main {
  public static void main(String[] args) {
     Date date = Date.valueOf("2000-01-12");
     System.out.println("date:"+date);
     //from   w w  w .j  a v  a 2s  .  c  o  m
     LocalDate localDate = date.toLocalDate();
     System.out.println("local date:"+localDate);

  }
}



PreviousNext

Related