开发者

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

开发者 https://www.devze.com 2023-01-25 10:50 出处:网络
This question already has answers here: Closed 12 years ago. Possible Duplicate: C开发者_开发百科an Ruby print out time difference (duration) readily?
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

精彩评论

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