공부
[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