티스토리 뷰

728x90
try {
    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss.SSS");
    Date parsedDate = dateFormat.parse(yourString);
    Timestamp timestamp = new java.sql.Timestamp(parsedDate.getTime());
} catch(Exception e) { 
    // this generic but you can control another types of exception
    // look the origin of excption 
}

 

[출처] https://stackoverflow.com/questions/18915075/java-convert-string-to-timestamp

728x90
댓글