How to Set post between two consecutive dates n ruby on rails

Task :: How to Set post between two consecutive dates n ruby on rails

Query at Google  :::: How to find out or extract data by Time.now :: In Between Start_date and end_date 

1.

Client.where(created_at: (Time.now.midnight - 1.day)..Time.now.midnight)

https://www.codegrepper.com/code-examples/whatever/rails+query+between+two+dates


2. 

https://blog.revathskumar.com/2012/11/ruby-generate-date-range.html


3.

https://blog.revathskumar.com/2012/11/ruby-generate-date-range.html


Solution Given by R ::

Post.where('starts_at' > ?'  DateTime.now)

Post.where('starts_at' > ?' DateTime.now+1.day)

?  :: I think this ? show the Between 

starts_at ::: Is the column in any project 

DateTime.now ::: It is the paradigm of the Rails











Comments

Popular posts from this blog

Rails 7 Features :: Comparison with Rails 6 and Rails 5