I\'ve got an amount of seconds that passed from a certain event. It\'s stored in a NSTimeInterval data type.
seconds
NSTimeInterval
I want to convert it into
Brian Ramsay’s code, de-pseudofied:
- (NSString*)formattedStringForDuration:(NSTimeInterval)duration { NSInteger minutes = floor(duration/60); NSInteger seconds = round(duration - minutes * 60); return [NSString stringWithFormat:@"%d:%02d", minutes, seconds]; }