| Author |
truncation errors storing a Date in MySQL table
|
mat buckland
Greenhorn
Joined: Sep 01, 2009
Posts: 24
|
|
I have a 'timestamp' field in a mysql table.
when I attempt to insert a Date into the table. Like this:
I get the error: Data truncation: Incorrect datetime value: 'Thu Oct 01 11:08:57 BST 2009'
I've tried changing the timestamp field to DATETIME, TIMESTAMP and DATE but to no avail.
What am I doing wrong?
thanks
|
 |
Jan Cumps
Bartender
Joined: Dec 20, 2006
Posts: 2343
|
|
Use a java.sql.PreparedStatement and set the time with setDateTime();
If you would print your sql statement before executing it, you would see why it fails. The value of currenTime is not what you expect.
Regards, Jan
|
OCUP UML fundamental
ITIL foundation
|
 |
 |
|
|
subject: truncation errors storing a Date in MySQL table
|
|
|