Time difference in hours
Try Time Difference gem for Ruby at https://rubygems.org/gems/time_difference
start_time = Time.new(2013,1)
end_time = Time.new(2014,1)
TimeDifference.between(start_time, end_time).in_years
this works great, example for number of hours since user created account
(Time.parse(DateTime.now.to_s) - Time.parse(current_user.created_at.to_s))/3600
((date_2 - date_1) / 3600).round
or
((date_2 - date_1) / 1.hour).round
You can use a gem called time_diff to get the time difference in very useful formats