Given an NSTimeInterval representing a time period, how do I create a user-readable string that expresses this time period in a way that matches i18N?
For example, if NSTimeInterval is 10823.23435 seconds, then some reasonable ways to do this as a string for those in the US might be:
- 3:23
- 3 hours, 23 seconds
- and etc.
(Ie, the material you'll see on the stopwatch.)
Presumably, other locales may use different visualizations.
I know NSDateFormatter and NSNumberFormatter, but I don’t understand if and how to use one of them for this problem.
I also know FormatterKit, but these are only relative time periods (for example, "3 minutes ago"). I am looking for absolute periods of time.
It is trivial to prepare your own locale-specific solution, but has this problem been solved properly already?
Thank.
source
share