如何返回人类可读的时间范围? [英] How can I return a human readable time range?
本文介绍了如何返回人类可读的时间范围?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用下面的代码返回一个数字,但它不是人类可读的.如何将其转换为 x hours x mins x second
格式?
I used the code below to return a number, but it's not human readable. How do I convert it to a x hours x mins x second
format?
ruby-1.9.2-p0 > Time.now.end_of_day() -Time.now
=> 31612.235963075
推荐答案
使用 distance_of_time_in_words
(Time.now, Time.now.end_of_day)
这篇关于如何返回人类可读的时间范围?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文