On Wed, Jan 19, 2011 at 1:54 AM, ojonam <[email protected]> wrote: > Hi, > > I have a model Status with fields 'name', 'time', of which 'time' is a > timestamp. I perform a find query and try to cast timestamp as date: > > $status = $this->Status->find('all', array('fields' => array('CAST > (Status.time AS DATE) time'))); > > debug($status) gives me : > > Array > ( > [0] => Array > ( > [Status] => Array > ( > [name] => AF1234 > ) > > [0] => Array > ( > [time] => 2010-12-02 15:05:11 > ) > > ) > > ) > > How do I retrieve the time data from the array? $status[0]['time'] > does not work.
You can also avoid how Cake serves the result of calculated fields in AppModel::afterFind: http://teknoid.wordpress.com/2008/09/29/dealing-with-calculated-fields-in-cakephps-find/ -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php
