I have this code in my cakephp project:
$this->data['MyObject']['expire_date'] = 'NOW()';
and...
$this->MyObject->save($this->data);
But this will not save the data in the database. After googling, I found that I can use now () like this. But it seems wrong, what's the right way to use it?
PS: My MySQL field is of type "DATE". It works if I use like this:
$this->data['MyObject']['expire_date'] = date( 'Y-m-d', mktime(0, 0, 0, date("m"), date("d")+30, date("Y")));
source
share