在 Ruby 中如何为 SQL 查询获取没有小时/分钟/秒的当前日期
In Ruby how to get current date without the hour / min / second for a SQL query
我想做:
ItemCheck.where('created_at between ?',today, today + 1.day) # <- from 12:00 midnight -> 12:00 midnight
有没有办法做到 Time.new 并告诉它丢弃小时/分钟/秒值?
我喜欢做这样的事情
ItemCheck.where(:created_at => @selected_date.beginning_of_day..@selected_date.end_of_day)
也看看Rails ActiveRecord date between
我想做:
ItemCheck.where('created_at between ?',today, today + 1.day) # <- from 12:00 midnight -> 12:00 midnight
有没有办法做到 Time.new 并告诉它丢弃小时/分钟/秒值?
我喜欢做这样的事情
ItemCheck.where(:created_at => @selected_date.beginning_of_day..@selected_date.end_of_day)
也看看Rails ActiveRecord date between