Question: I am working on Quiz App. In my app I want to get difference between quiz start time and end time. How to get difference between start and end time.

Thanks in advance.

Answer: 
You can use **NSDate** `- (NSTimeInterval)timeIntervalSinceDate:(NSDate *)anotherDate` for this purpose.
Use this 

```
 NSDateFormatter *dateFormatter1 = [[NSDateFormatter alloc] init];
    [dateFormatter1 setDateFormat:@"MM/dd/yy"];
    NSDate *today = [NSDate date];
    NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
    [dateFormat setDateFormat:@"MM/dd/yy"];
    NSString *dateString11 = [dateFormat stringFromDate:today];
    NSDate *today1 = [dateFormatter1 dateFromString:dateString11];
    NSDate *ExpDate = [[NSUserDefaults standardUserDefaults]objectForKey:@"ExpDate"];
    NSTimeInterval interval = [ExpDate timeIntervalSinceDate:today1];
    int diff=interval/86400;

```

i hope this code useful for you.

And Another code for you.

```
 NSDate *date = [NSDate date];
NSDateFormatter *dateFormatter1 = [[NSDateFormatter alloc] init];
[dateFormatter1 setDateFormat:@"MM/dd/yyyy"];
NSDate *ServerDate = [dateFormatter1 dateFromString:@"04/26/2013"];
[dateFormatter1 release];
NSTimeInterval interval = [date timeIntervalSinceDate:ServerDate];
int diff=interval/86400;
NSLog(@"%d",diff);

```