在Ruby中减去日期,并在几分钟内得到差异 [英] Subtract dates in Ruby and get the difference in minutes
本文介绍了在Ruby中减去日期,并在几分钟内得到差异的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在Ruby中减去两个不同的UTC日期,然后在几分钟内得到差异?
how do i subtract two different UTC dates in Ruby and then get the difference in minutes?
谢谢
推荐答案
(time1 - time2)/ 60
(time1 - time2) / 60
如果时间对象是字符串, Time.parse (时间)
他们首先
If the time objects are string, Time.parse(time)
them first
这篇关于在Ruby中减去日期,并在几分钟内得到差异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文