Reputation: 1394
I found How to convert seconds to 11:00:30.1 format but can't find how to convert hours in format 11:00:30.1 to seconds. Please give me some links.
Upvotes: 0
Views: 366
Reputation: 29552
NSString *string = @"11:00:30.1";;
NSDateFormatter *dateFormatter= [[[NSDateFormatter alloc] init] autorelease];
[dateFormatter setDateFormat:@"HH:mm:ss.SS"];
NSDate *date = [dateFormatter dateFromString:string];
NSTimeInterval seconds = [date timeIntervalSince1970];
Edit: Thanks to Johan Kool for pointing me at NSDateFormatter. Updated code for simplicity.
Upvotes: 5