Java LocalTime convert to SQL Time

Description

Java LocalTime convert to SQL Time

import java.sql.Time;
import java.time.LocalTime;


public class Main {
  public static void main(String[] args) {
     //from   w  w  w .  j a  va 2 s  .  co  m
     LocalTime localTime = LocalTime.now();
     System.out.println("local time:"+localTime);
     
     Time time = Time.valueOf(localTime);
     System.out.println("time:"+time);
     
  }
}



PreviousNext

Related