Datediff is my preferred comparison since it does not fail on leap-
years and things like that.
DATEDIFF(date1,date2) > 0
-> true or false
To construct modified versions of today I sometimes use Addate adn
Subdate
ADDDATE(CURDATE(), INTERVAL 4 HOUR)
-> 2009-01-26 04:00:00
/Martin
On Jan 26, 12:53 am, Parris <presid...@parrisstudios.com> wrote:
> Hi Everyone,
> I am just trying to perform a simple query using cakephp. In the
> conditions array I am trying to filter by dates. The results should be
> all 'events' that will be today or greater (in other words, any date
> in the future).
>
> $this->Event->find('all',array( 'conditions' =>array
> ('event_category_id'=>$catId,'DATE(Event.event_date)'=>'getdate
> ()'),'order'=>array('Event.event_date ASC','Event.event_time
> ASC') ) ) ;
>
> That is what i have so far. The first condition is just to filter by
> category. The part I need help with is 'DATE
> (Event.event_date)'=>'getdate()'). There are no errors. So i guess its
> kind of working. Also how can i adjust 'today' by 4 hours ?
>
> Thanks!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---
No comments:
Post a Comment