Parse time from seconds to hours:minutes:seconds
[gist https://gist.github.com/5bc12ef4902bf1ce8fb7 /]
- (NSString *)formattedTime {
int seconds = [self.duration intValue] % 60;
int minutes = [self.duration intValue] / 60;
int hours = [self.duration intValue] / 3600;
return [NSString stringWithFormat:@"%02d:%02d:%02d", hours, minutes, seconds];
}
//Better solution
- (NSString *)timeFormatted:(int)totalSeconds{
int seconds = totalSeconds % 60;
int minutes = (totalSeconds / 60) % 60;
int hours = totalSeconds / 3600;
return [NSString stringWithFormat:@"%02d:%02d:%02d",hours, minutes, seconds];
}