I have two time columns stored in a Postgresql database: open_time
and close_time
. I'm trying to find out if the current time, ignoring the date, is between the two times, ignoring the dates.
This code compares the dates as well as the time:
current_time = Time.now
if current_time.between?(store.open_time, store.close_time)
puts "IN BETWEEN"
end
It doesn't work, for example, when current_time # => 2018-06-06 23:59:49 -0600
and open_time # => 2000-01-01 22:59:00 UTC
.
How do I get it to not include the dates, and just compare the times?