Rails 3 DateTime Comparison w/ Date In An ActiveRecord Query

前端 未结 4 1337
死守一世寂寞
死守一世寂寞 2021-02-09 00:58

I\'m trying to search a model for any dates equal to a specific date while omitting the timestamp. In Rails I could simply execute this as DateTime.to_date == somedate

4条回答
  •  面向向阳花
    2021-02-09 01:55

    Try created_at >= some_day_with_00:00:00 timestamp and create_at < some_day_plus_one_with_00:00:00 timestamp

提交回复
热议问题