This is speculation only, but maybe define your field parameter in the find statement, so that the "newdate" comes first! Enjoy, John
On Feb 20, 4:42 pm, Tapan Kumar Thapa <[email protected]> wrote: > Thanks for your suggestion. > > I have implemented this in my model. > > var $virtualFields = array( > 'newdate' => 'DATE_FORMAT(Incoming.date, "%d-%b-%y")' > ); > > It works as charm however now i have got another problem. > > now my new date is coming in last like this. > > SELECT `Incoming`.`time`, `Incoming`.`msisdn`, `Incoming`.`shortcode`, > `Incoming`.`operator`, `Incoming`.`circle`, `Incoming`.`keyword`, > `Incoming`.`answer`, `Incoming`.`age`, `Incoming`.`gender`, > `Incoming`.`status`, *(DATE_FORMAT(`Incoming`.`date`, "%d-%b-%y")) AS > `Incoming__newdate`* FROM `incomings` AS `Incoming` WHERE > `Incoming`.`created` >= '2011-02-08 00:00:00' AND `Incoming`.`created` <= > '2011-02-20 20:55:00' ORDER BY `Incoming`.`id` desc LIMIT 20, 20 > > However i want like this: > > SELECT *(DATE_FORMAT(`Incoming`.`date`, "%d-%b-%y")) AS > `Incoming__newdate`*,`Incoming`.`time`, > `Incoming`.`msisdn`, `Incoming`.`shortcode`, `Incoming`.`operator`, > `Incoming`.`circle`, `Incoming`.`keyword`, `Incoming`.`answer`, > `Incoming`.`age`, `Incoming`.`gender`, `Incoming`.`status` FROM `incomings` > AS `Incoming` WHERE `Incoming`.`created` >= '2011-02-08 00:00:00' AND > `Incoming`.`created` <= '2011-02-20 20:55:00' ORDER BY `Incoming`.`id` desc > LIMIT 20, 20 > > Please suggest. > > Regards > Tapan Thapa > India > > On Sun, Feb 20, 2011 at 8:28 PM, John Andersen <[email protected]>wrote: > > > Please show us how the view code looks like, maybe we can suggest > > something based on that. > > > If you can't then you may be able to use a virtual field for this, > > look at the CakePHP book at: > >http://book.cakephp.org/view/1608/Virtual-fields > > > Enjoy, > > John > > > On Feb 20, 3:45 pm, Tapan Kumar Thapa <[email protected]> > > wrote: > > > Unfortunately no....(:- > > > > I have an export csv option via a html link and i am not presenting this > > > data to my view. > > > > Please suggest if this can be achieved in controller itself. > > > > Regards > > > Tapan Thapa > > > India > > > [snip] > > > -- > > Our newest site for the community: CakePHP Video Tutorials > >http://tv.cakephp.org > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help > > others with their CakePHP related questions. > > > To unsubscribe from this group, send email to > > [email protected] For more options, visit this group > > athttp://groups.google.com/group/cake-php -- 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
