티스토리 뷰

공부

[Java] convert `String` to `TimeStamp`

승가비 2019. 10. 15. 00:17
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

'공부' 카테고리의 다른 글

[JS] execute `string name function`  (0) 2019.10.15
[Git] How to `unrevert ` a previously reverted commit?  (0) 2019.10.15
[JS] get element from within an `iframe`  (0) 2019.10.15
[JS] RegExp  (0) 2019.10.15
[JS] CORS(Cross Origin Request Security)  (0) 2019.10.14
댓글