I've been banging my head at this one:
I have a table with columns start_time
an end_time
as well as start_date
and end_date
, and I have a Time
object called test_time
. I need to be able to match these values in a sql query. ie.
Reservation.find :all, :conditions => ["'start_time' <= ? AND 'end_time' >= ?", test_time, test_time]
Assuming we are only looking at Time and not Date, how can I determine whether or not test_time
is within the range of time beginning at start_time
and ending at end_time
. In other words, 11:30am is between 11:15am and 11:45am. I've tried SQL BETWEEN clause, but was unsuccessful.