Rails 3 app, pg adapter, my schema look as:
create_table "events", :force => true do |t|
t.integer "event_type_id"
t.datetime "start_at"
#...
end
Some example data include:
p.events.each{|e| puts e.start_at }; 1
2009-03-23 08:30:00 UTC
2009-05-20 07:45:00 UTC
2009-05-20 07:45:00 UTC
2009-03-23 16:00:00 UTC
2009-05-20 10:00:00 UTC
2009-03-23 19:30:00 UTC
2009-03-23 11:30:00 UTC
2009-05-20 07:45:00 UTC
2009-05-20 07:45:00 UTC
2009-05-20 09:00:00 UTC
2009-05-20 07:45:00 UTC
I’d like to search in between the next 3 hours, but ignoring the day! Hour and minute is all that matters to me..
Is it possible to be done in Postgres? I’ve been trying to use pg EXTRACT(), but no success so far
I don’t want to filter all dates in ruby code 🙁
Ignoring the minutes, and only taking into account the hours:
result: