Doctrine 条令DQL更新和位置(';日期U格式(日期,Y-%m-%d)=?';,';2013-08-09 12:24:09';)
我在更新行时遇到问题,数据库中的日期格式是:Y-m-d H:I:sDoctrine 条令DQL更新和位置(';日期U格式(日期,Y-%m-%d)=?';,';2013-08-09 12:24:09';),doctrine,date-format,Doctrine,Date Format,我在更新行时遇到问题,数据库中的日期格式是:Y-m-d H:I:s $date ='2013-08-09';// from POST Doctrine_Query::create() ->update( 'column z2ud' ) ->set( array( 'z2ud.column' => 'value' ) )// ->where( 'z2ud.column = ?', 'value' ) ->andWhere( 'DATE_FORMAT(
$date ='2013-08-09';// from POST
Doctrine_Query::create()
->update( 'column z2ud' )
->set( array( 'z2ud.column' => 'value' ) )//
->where( 'z2ud.column = ?', 'value' )
->andWhere( 'DATE_FORMAT(date, "%Y-%m-%d" ) = ?', $date)
->execute();
SQL返回:
未知聚合别名:“%Y-%m-%d”
已解决:您必须使用\'%Y-%m-%d\'而不是->%Y-%m-%d”您选择了哪种数据类型来存储日期?是的,我看到现在有人将该类型更改为timestamp Thx,我将重试。