When I was developing video recording application, I had to display the time in HH:MM:SS format.
I wrote a utility method which does the same. It takes seconds as input and returns a NSString. Hope this helps iOS community :)
I wrote a utility method which does the same. It takes seconds as input and returns a NSString. Hope this helps iOS community :)
NSString * formatHHMMSSStringFromSeconds(int seconds) { NSString *timeString = @""; int minutes = seconds / 60; seconds = seconds % 60; int hours = 0; if(minutes > 60) { hours = minutes / 60; minutes = minutes % 60; } timeString = [timeString stringByAppendingFormat:@"%02d:%02d:%02d",hours,minutes, seconds]; return timeString; }