MySQL 1292 Invalid date and time value

I get this error when I try to insert "2011/03/13 02: 53: 50.0000000000" into the timestamp column. If I change 13 to 15, 14, 12, or 11, that is not a problem. I also tried changing / to - and still not-go.

I looked at some other topics related to this error, but no one is applicable.

I am running version 5.7.9.

Thanks Mark

+4
source share
4 answers

It took me a while to figure this out ...

, "2011-03-13 02:53:50" - 2 3 , 2 3 . '2016-03-13 02:32:21' ..

, DST, .

+12

:

STR_TO_DATE( '2011/03/13 02:53:50', '%Y/%m/%d %H:%i:%s')

, (-),

'2011-03-13 02:53:50' 

SQL FIDDLE DEMO

0

, str MySQL . , MySQL.

. MySQL :

DATETIME TIMESTAMP - (6 ).


UPDATE: localhost MySQL, .

select str_to_date("2011-03-13 02:53:50.000000", "%Y-%m-%d %H:%i:%s.%f") as `t`

:

+----------------------------+
| t                          |
+----------------------------+
| 2011-03-13 02:53:50.000000 |
+----------------------------+
1 row in set (0.00 sec)

SQLFiddle, MySQL.

, , " " MySQL + OS.

0

Still not sure if the problem / was maybe a combination of CentOS and MySQL versions. I changed the column to datatime (6) instead of timestamp (6) and I was able to successfully import all my data.

0
source

All Articles