0

I want to do:

ItemCheck.where('created_at between ?',today, today + 1.day) # <- from 12:00 midnight -> 12:00 midnight

Is there a way to do Time.new and tell it to throw away the hour / min / second values?

halfer
  • 19,824
  • 17
  • 99
  • 186
timpone
  • 19,235
  • 36
  • 121
  • 211
  • possible duplicate of [Rails ActiveRecord date between](http://stackoverflow.com/questions/2381718/rails-activerecord-date-between) – MZaragoza Jan 12 '15 at 18:47

1 Answers1

1

I like to do something like this

ItemCheck.where(:created_at => @selected_date.beginning_of_day..@selected_date.end_of_day)

also look at Rails ActiveRecord date between

Community
  • 1
  • 1
MZaragoza
  • 10,108
  • 9
  • 71
  • 116
  • thx, ended up doing it like: ics=ItemCheck.where('(created_at between ? and ?) and location_id=?',today.beginning_of_day, today.end_of_day, location_id) – timpone Jan 12 '15 at 23:24