Java LocalDate convert to SQL Date

Description

Java LocalDate convert to SQL Date

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


public class Main {
  public static void main(String[] args) {
     LocalDate localDate = LocalDate.now();
     System.out.println("local date:"+localDate);
     //  w  ww  . j av  a  2s  .c  o  m
     Date date = Date.valueOf(localDate);
     System.out.println("date:"+date);
     

  }
}



PreviousNext

Related