Presentation of the data, your date and time fields, should be done in
the view, not in the controller, so just move the formatting to the
view. Would that be an acceptable solution for you?
Enjoy,
   John

On Feb 20, 2:58 pm, Tapan Kumar Thapa <[email protected]>
wrote:
> Hello Community,
>
> I have an export function in my controller.
>
> function export() {
>         $this->layout = '';
>         $startdate = $this->Session->read('startdate');
>         $enddate = $this->Session->read('enddate');
>         $this->set('Export', $this->Incoming->find('all', array(
>                     'fields' => array('date', 'time', 'msisdn', 'shortcode',
> 'operator', 'circle', 'keyword', 'answer', 'age', 'gender'),
>                     'order' => "Incoming.id desc",
>                     'conditions' => array("Incoming.created >= '$startdate'
> AND Incoming.created <= '$enddate' "),
>                     'contain' => false)));
>     }
>
> I want this control look like this.
>
> function export() {
>         $this->layout = '';
>         $startdate = $this->Session->read('startdate');
>         $enddate = $this->Session->read('enddate');
>         $this->set('Export', $this->Incoming->find('all', array(
>                     'fields' => array('date_format(date, '%d-%b-%y') as
> date', 'time', 'msisdn', 'shortcode', 'operator', 'circle', 'keyword',
> 'answer', 'age', 'gender'),
>                     'order' => "Incoming.id desc",
>                     'conditions' => array("Incoming.created >= '$startdate'
> AND Incoming.created <= '$enddate' "),
>                     'contain' => false)));
>     }
>
> Please suggest.
>
> Regards
> Tapan Thapa
> India

-- 
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

Reply via email to