0

Possible Duplicate:
Can 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'?

Community
  • 1
  • 1
GSto
  • 40,278
  • 37
  • 127
  • 179

1 Answers1

0

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

Jakub Hampl
  • 38,520
  • 9
  • 73
  • 103