Java SQL Timestamp create from String as "2020-02-24 12:42:42.11"
import java.sql.Timestamp; import java.time.Instant; public class Main { public static void main(String[] args) { // ww w .j a v a 2 s. c o m Timestamp timestamp = Timestamp.valueOf("2020-02-24 12:42:42.11"); System.out.println("timestamp:"+timestamp); Instant ins = timestamp.toInstant(); System.out.println("ins:"+ins); } }