Milap
Milap

Reputation: 145

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?

Upvotes: 0

Views: 4945

Answers (2)

dpk
dpk

Reputation: 641

Use to_date function.

to_date('2009-09-14 10:33:11',yyyy-MM-dd hh:mm:ss)

Upvotes: 1

Mosty Mostacho
Mosty Mostacho

Reputation: 43434

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.

Upvotes: 2

Related Questions