views:

85

answers:

1

I'm looking for a class that formats time intervals like this:

1 hour 3 minutes
2 hours 5 minutes 12 seconds
5 days 2 hours

Is there anything built-in or a library that supports this kind of time interval formatting?

I thought about doing it myself, but there are all sorts of problems:

  • Localization
  • Non-gregorian calendars.
+1  A: 

You can find some hints on CocoaDev Forums. Suggested solutions involve NSCalendar and NSDateComponents.

mouviciel
Been there. I couldn't find out how this would help.
Georg
gs: It will give you the numbers of years, months, etc., which you can then format into a string. Use `NSLocalizedString` to retrieve localized names of units from your Localizable.strings file.
Peter Hosey