I have a table with this column:
last_modified timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
And it looks like I cannot insert a line with a custom timestamp, I get this error:
Invalid date and time value: '1145868501' for last_modified column in row 1
I am trying to populate this table with data coming from another table, that there is a create_time field in the other table, which is DATETIME, so I use UNIX_TIMESTAMP (creation_time) to populate the timestamp.
I think the timestamp column with "DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP" does not allow me to insert my own things, right? If so, where is the official document on this and what is the best solution? First create a simple timestamp, and then change the table after inserting the data?
Thank!
EDIT: since people advise me not to use UNIX_TIMESTAMP, I have to say that I did not want to use this at the beginning, but I got this error: Invalid date and time value: '2010-03-28 02:15:51' for the column 'last_modified' So I thought I needed to insert a “real” timestamp ...
source
share