- (NSString *)formateTime:(NSTimeInterval)time
{
第一种: 00:06
NSDate *date = [NSDate dateWithTimeIntervalSince1970:time];
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setTimeZone:[NSTimeZone timeZoneForSecondsFromGMT:0]];
if (time >= 3600) {
[formatter setDateFormat:@"HH:mm:ss"];
} else {
[formatter setDateFormat:@"mm:ss"];
}
return [formatter stringFromDate:date];
第二种:00:6
// int num = (int)time;
// int min = num/60;
// int sec = num%60;
// if(num <60)
// {
// return [NSString stringWithFormat:@"0:%2d",sec];
// }
// else
// {
// return [NSString stringWithFormat:@"%2d:%2d",min,sec];
// }
//
}