how to use mysql now() function in cakephp for date fields?

后端 未结 5 1700
我寻月下人不归
我寻月下人不归 2021-01-21 12:02

I have this code in my cakephp project:

$this->data[\'MyObject\'][\'expire_date\'] = \'NOW()\';

and...

$this->MyObject-&g         


        
5条回答
  •  深忆病人
    2021-01-21 12:35

    For cakephp 2.x users:

    $db = $this->MyObject->getDataSource(); 
    
    
    $this->data['MyObject']['expire_date'] = $db->expression('NOW()');
    

提交回复
热议问题