Skip to content
Advertisement

How to write a query to compare current date to created_at timestamps in database?

I would like to write a query to compare created_at timestamp with my current date in Ruby on Rails using ActiveRecord and I don’t quite know how do it yet

Date is stored like this -> created_at: 2019-06-03 03:30:40

Advertisement

Answer

Try this:

Or you can use:

Source: https://apidock.com/rails/ActionView/Helpers/DateHelper/time_ago_in_words

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement