0

I have a table

CREATE TEMPORARY TABLE test (stamp TIMESTAMP);

And try to run inserts on it

INSERT INTO test VALUES('2003-01-01')

Fails with Incorrect datetime value: '2003-01-01' for column 'stamp' at row 1

And this one works

INSERT INTO test VALUES('2004-01-01')

Why would that happen?

clorz
  • 1,103
  • 3
  • 14
  • 30

1 Answers1

1

You should not use TIMESTAMP:

CREATE TEMPORARY TABLE `test` (`stamp` DATETIME);

You need to give that in the right format:

INSERT INTO `test` VALUES ('2004-01-01 00:00:00')
Praveen Kumar Purushothaman
  • 164,888
  • 24
  • 203
  • 252