您好我有代碼分離小時,分,秒 現在我要它轉換爲seconds.and的NSNumber轉換HH:MM:SS以秒在Xcode
NSRange range = [string rangeOfString:@":"];
NSString *hour = [string substringToIndex:range.location];
NSLog(@"time %@",hour);
NSRange range1= NSMakeRange(2,2);
NSString *min = [string substringWithRange:range1];
NSLog(@"time %@",min);
NSRange range2 = NSMakeRange(5,2);
NSString *sec = [string substringWithRange:range2];
NSLog(@"time %@",sec);
你想,因爲日曆(1970年)開始秒或自午夜? – Manuel