I have two dates like startDate = 2016-02-24 10:25:11 +0000 and endDate = 2016-02-24 10:26:11 +0000.
I want to find time interval between these dates in seconds.
Thanks in advance.
I have two dates like startDate = 2016-02-24 10:25:11 +0000 and endDate = 2016-02-24 10:26:11 +0000.
I want to find time interval between these dates in seconds.
Thanks in advance.
Hope this can help you.
NSString *startDate = @"2016-02-24 10:25:11 +0000";
NSString *endDate = @"2016-02-24 10:26:11 +0000";
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat:@"yyyy-MM-dd HH:mm:ss Z"];
NSDate *start = [formatter dateFromString:startDate];
NSDate *end = [formatter dateFromString:endDate];
NSTimeInterval interval = [end timeIntervalSinceDate:start];
NSLog(@"time interval:%f", interval);