Answer the question
In order to leave comments, you need to log in
How to find the difference in hours between two times in Ruby?
For example, there are two tenses:
old_date = Tue, 08 Sep 2015 14:52:18 MSK +03:00
new_date = Tue, 08 Sep 2015 16:52:18 MSK +03:00
Answer the question
In order to leave comments, you need to log in
old_date = Time.parse('Tue, 08 Sep 2015 14:52:18 MSK +03:00') %>
today_date = Time.parse('Tue, 08 Sep 2015 17:52:18 MSK +03:00') %>
((today_date - old_date).to_i / 60 ) / 60 # 3
Everything is the same as before How to find the difference in hours in two dates in RUBY ???
Finally read the documentation
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question