My code uses Java.sql.Timestamp to store an update date. I want to take that date and store it into a mySQL datetime object. My problem is that the Java.util.Timestamp returns a date in the format of 2013-12-09 00:00:00.00 but the mySQL colunmn wants the format in 2013-12-09 00:00:00. So it looks like I need to trim off the .00 of the java.sql.Timestamp.
Add a comment
|
1 Answer
You don't need to insert timestamp in mysql as String, just treat it as java.sql.Timestamp and use PreparedStatement to set the value properly
1 Comment
Alex Clark
I do just add the timestamp and it kicks this error
com.mysql.jdbc.MysqlDataTruncation: Data truncation: Incorrect datetime value: '' for column 'update_date' at row 1