How to display number as an hour from duration in iOS?
c, ios, nsstring, objective-c
Solution
Enjoy! :)
NSTimeInterval _timeInterval = 127.f;
NSInteger _hours = _timeInterval / 60;
NSInteger _minutes = (NSInteger)_timeInterval % 60;
NSLog(@"%02d:%02d", _hours, _minutes);
Problem
Is there a way to display a number as an hour from a duration ? For example i have a NSTimeInterval value containing `127` and i want to display `02:07`. What's the better way to do that ? Thanks.