I am trying to get the difference in hours for two different Time instances. I get these values from the DB as a :datetime column
How can I do this so that it includes the months and years as well in the calculation while ignoring or rounding the minutes? Can this only be done manually or is there a function to do this?
You can use a Rails' method
distance_of_time_in_words
or
You can use a gem called time_diff to get the time difference in very useful formats
this works great, example for number of hours since user created account
In Rails, there is now a far more natural way to achieve this:
Try Time Difference gem for Ruby at https://rubygems.org/gems/time_difference