There are a few ways you can do this. One way is to create a criterion to
AND between the same date and two different times like:

$c = new Criteria();
$criterion = $c->getNewCriterion(ItineraryPeer::START_TIME, $date."
00:00:00", Criteria::GREATER_EQUAL);
$criterion->addAnd($c->getNewCriterion(ItineraryPeer::START_TIME, $date."
23:59:59", Criteria::LESS_EQUAL));
$c->add($criterion);

Another way is to do a bit of a custom query:

$c = new Criteria();
$c->add(ItineraryPeer::START_TIME, "DATE(".ItineraryPeer::START_TIME . ") =
".$start_time, Criteria::CUSTOM);

Custom is a little frowned on because then you are breaking the nice
abstractedness of an ORM, but the criterion example I just gave might seem a
bit "kludgy". Both will work however and in my opinion keeping abstraction
is more important than cleanliness so the first option is probably better.

On Mon, Sep 28, 2009 at 8:48 AM, Avani <avani.v.puj...@gmail.com> wrote:

>
> Hi all,
>
> I want your help for comparing date.
>
> In my database, I have 1 column named "start_time" and it's type is
> "datetime".
>
> Now, I want to display records by comparing date only. Time need to be
> ignored while comparing. I dont know how to do this using criteria.
>
> $c_iti  = new Criteria();
> $c_iti->add(ItineraryPeer::START_TIME,$start_time);
> $itinerary_list = ItineraryPeer::doSelect($c_iti);
>
> Can anybody help me?
>
> Thanks in advance.
> >
>


-- 
Gareth McCumskey
http://garethmccumskey.blogspot.com
twitter: @garethmcc

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to 
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to