标签: ruby-on-rails ruby ruby-on-rails-3
我使用下面的代码返回一个数字,但它不是人类可读的。如何将其转换为x hours x mins x second格式?
x hours x mins x second
ruby-1.9.2-p0 > Time.now.end_of_day() -Time.now => 31612.235963075
答案 0 :(得分:4)
使用distance_of_time_in_words (Time.now, Time.now.end_of_day)
distance_of_time_in_words
(Time.now, Time.now.end_of_day)