Ruby: format number of seconds to formatted time [duplicate]
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
精彩评论