Mysql date warning data truncated

后端 未结 2 1629
别跟我提以往
别跟我提以往 2021-01-18 01:10

I\'m having an interesting issue with Mysql DATE format. I have this table :

| id          | int(11)      | NO   | PRI | NULL    | auto_increment |
| file_pa         


        
相关标签:
2条回答
  • 2021-01-18 01:59

    Posted query

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

    What it should be

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

    MySQL Support DATE format as 'YYYY-MM-DD' , Year then Month then Date, So you are updating a Date column with wrong value "2014-23-01" , There are only 12 months in year, you are using month 23 which is invalid that's MySQL is converting it to ZERO DATE (0000-00-00)

    0 讨论(0)
  • 2021-01-18 02:08

    I had a similar problem recently, my issue was that I was trying to upload a datetime object as a date object. Although that's not the same issue that Gui O was having, if you run into this, make sure that you're actually trying to upload a date object.

    0 讨论(0)
提交回复
热议问题