Skip to content

Instantly share code, notes, and snippets.

@inailuy
Created March 21, 2013 19:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save inailuy/5216002 to your computer and use it in GitHub Desktop.
Save inailuy/5216002 to your computer and use it in GitHub Desktop.
Convert Seconds to Minutes as a NSString
- (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];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment