Java SQL Date convert to Instant

Description

Java SQL Date convert to Instant

import java.sql.Date;
import java.time.Instant;


public class Main {
  public static void main(String[] args) {
     Date date = Date.valueOf("2000-01-12");
     System.out.println("date:"+date);
     //from ww w.ja va  2 s  .  c om
     Instant ins = date.toInstant();
     System.out.println("ins:"+ins);

  }
}



PreviousNext

Related