on-the-way on-the-way - 2 months ago 5x
Ruby Question

Date diiference in days

I am subtracting two dates and I want to get the difference converted to days. How can I achive it?
I do it like below and it returns the result below, how can I convert the result as days?

=> Fri, 05 Aug 2016 16:53:01 HKT +08:00
=> Fri, 28 Aug 2015 07:59:43 HKT +08:00
article.created_at - message.created_at
=> 29667198.69661808


You should be able to just divide by a day...

(article.created_at - message.created_at) / 1.day