Showing posts with label date diff. Show all posts
Showing posts with label date diff. Show all posts

Thursday, July 19, 2012

Get the Date difference in days

Hello guys,
        Wanna to get the date difference in terms of days?

eg.
date_x = Time.now.to_date
date_y = Date.parse('2012-05-20')

passed_days = (date_x.to_date - date_y.to_date).to_i

passed_days should give the date difference in days.