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
  • 41,512
  • 37
  • 133
  • 184

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
  • 39,863
  • 10
  • 77
  • 106