0
votes

While trying to insert a value into a DATETIME field I get the error:

Error Code: 1292. Incorrect datetime value: '​2019-08-13 19:00:00' for column 'my_date_time' at row 1

The insert looks like this:

INSERT INTO `table`(`my_date_time`) VALUES('​2019-08-13 19:00:00');

The table is along the lines of:

CREATE TABLE `table` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `my_date_time` datetime NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

PS: This is a MySQL 8 database.

1
how does your my_date_time look like? PS. Your whole table - xmaster
There is a non printing character before the last bracket.. - P.Salmon
im reading that it's a bug with some numbers - xmaster
That should actually work if the column is an actual DATETIME. You should try to retype the query without copy-pasting to prevent non printing character mess, if ever responsible for your problem. - Tom Desp
Just to clarify what @P.Salmon said, you have a U+200B "Zero-Width Space" character just in front of your year that should be removed. - phatfingers

1 Answers

0
votes

@P.Salmon (and @phatfingers) said in comments and answered:

you have a U+200B "Zero-Width Space" character just in front of your year that should be removed

.