Mysql Date Alert Data Truncated

I have an interesting problem with the Mysql DATE format. I have this table:

| id          | int(11)      | NO   | PRI | NULL    | auto_increment |
| file_path   | varchar(255) | YES  |     | NULL    |                |
| date_export | date         | YES  |     | NULL    |                |

When I update a string using the date: NOW () function, the date is updated in this format:

'2014-01-23'

But when I use a different date format, for example, written by hand:

update backup_conf_allied set date_export='2014-23-01' where file_path='IDF-952584-SW1' ;

The date_export column is converted to:

'0000-00-00'

A warning table tells me that:

| Warning | 1265 | Data truncated for column 'date_export' at row 3628 |

Why? The date format is the same as the NOW () function. Thanks.

+4
source share
2 answers

Request sent

update backup_conf_allied set `date_export='2014-23-01'` where file_path='IDF-952584-SW1' ;

What should it be

update backup_conf_allied set `date_export='2014-01-23'` where file_path='IDF-952584-SW1' ;

MySQL DATE "YYYY-MM-DD", Year then Month then Date, "" "2014-23-01". 12 , 23- , MySQL ZERO DATE (0000-00-00)

+9

, , datetime . , Gui O, , , .

0

Source: https://habr.com/ru/post/1523308/


All Articles