Reputation: 213
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
.
Upvotes: 0
Views: 670
Reputation: 240946
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
Upvotes: 1