Rails Console - Find where created at = certain day
Try this,
User.where("Date(updated_at) = ?", "2018-02-9")
You can also do it like
User.where("created_at::date = ?", "january 5 2013".to_date)
Yes, It is possible like:
date = Date.parse("january 5 2013")
users = User.where(created_at: date)
but created_at
is type of date-time like 2014-01-28 08:35:00.9608
and I think All user have different created_at
So you may used like this
User.where("created_at = ?", "2014-01-23 16:19:48.199086")
You can do it like this:
date = Date.parse('january 5 2013')
users = User.where(created_at: date.midnight..date.end_of_day)