MYSQL incorrect DATETIME format

前端 未结 4 1832
醉酒成梦
醉酒成梦 2020-12-09 16:15

I have an app with Doctrine 1 and I generate update_datetime fields for objects via new Zend_Date->getIso(). It worked just fine for years, but

4条回答
  •  不知归路
    2020-12-09 16:56

    This is caused by Zend not setting your timestamp format to one that matches what MySQL is expecting. You could disable STRICT mode in MySQL, but this is a hack and not a solution (MySQL will attempt to guess what the date you're entering is).

    In Zend you can set the datetime format to what MySQL is expecting to solve this:

    $log = new Zend_Log ();
    $log->setTimestampFormat("Y-m-d H:i:s");
    

提交回复
热议问题