Search code examples
mysqlsqldatemysql-error-1292

Error code 1292 incorrect Date | Time


Here is the SQL statement I am trying to enter:

INSERT INTO comments values (default, 'lars','[email protected]','http://www.vogella.com', '2009-09-14 10:33:11', 'Summary','My first comment');

But I'm getting a 1292 error about my date and time('2009-09-14 10:33:11'). I don't understand, the format seems to be correct. What am I missing?


Solution

  • Try this out:

    INSERT INTO comments values ('lars', '[email protected]','http://www.vogella.com', '2009-09-14', 'Summary','My first comment');
    

    You seem to be sending a datetime while your field is a date. Probably you should change your table structure from date to datetime.