开发者

Ruby: format number of seconds to formatted time [duplicate]

This question already has answers here: Closed 12 years ago.

Possible Duplicate:

C开发者_开发百科an Ruby print out time difference (duration) readily?

I have a length of time that is stored as a number of seconds. Is there a way to format it either into HH:MM format or to something human readable, such as '2 hours, 15 minutes'?


Easiest is to probably adapt the code used in this rails function: http://apidock.com/rails/ActionView/Helpers/DateHelper/distance_of_time_in_words

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜