Possible Duplicate:
NSNumber of seconds to Hours, minutes, seconds 开发者_Python百科
I have a large number that represents milliseconds.
I would like to format it out into Minutes: Seconds : Milliseconds;
Could anyone help me achieve this?
Convert to double, then scale to seconds. Then use NSDate dateWithTimeIntervalSinceReferenceDate (or NSDate dateWithTimeIntervalSince1970) to convert to an NSDate. From there you can format any number of ways with NSDateFormatter.
You can also, of course, simply use modular division:
int milliseconds = timeValue % 1000;
int temp = timeValue / 1000;
int seconds = temp % 60;
int minutes = temp / 60;
精彩评论