From: Rob Biedenharn Date: 2009-04-22T08:17:29+09:00 Subject: Re: comparing date problem On Apr 21, 2009, at 4:43 PM, Taneal Bhandari wrote: > Taneal Bhandari wrote: >> now = Time.now >> @events = Event.find(:all, :conditions => ["event_date > " + >> now.to_s, >> {:venue_id => @venue.id}]) > > Actually, I just realized that I also have to take into consideration > "event_time". Our table has 2 fields event_date and event_time, and I > only want to pull back records of events where both the event_date and > event_time have not passed. I've been playing around with it for a > bit, > but it doesn't like any combination that I've tried. Any thoughts? > -- :conditions => [ 'event_date > ? OR (event_date = ? AND event_time > ?)', now.to_date, now.to_date, now.strftime("%H:%M:%S") ] depending on what the format of event_time actually is, of course. -Rob Rob Biedenharn http://agileconsultingllc.com Rob@AgileConsultingLLC.com