Question: I have two strings coming from my server in which I store the time, and I need to compare the time interval between those two, in minutes, and if it's necessary, in hours. Should I convert to `NSDate` or use `NSString`?

The `NSString`s look like:

```
NOW 14:22
LAST TIME 10:18

```

EDIT #1
Since everyone is saying me to use NSDate, i converted the data in my database to DATETIME, and now i can compare the two NSDate using the following code :

```
    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
    [dateFormatter setLocale:[[NSLocale alloc] initWithLocaleIdentifier:@"pt_BR"]];
    [dateFormatter setDateFormat: @"yyyy-MM-dd HH:mm:ss"];

    NSDate *currentDateTimeWithOffset = [NSDate dateWithTimeIntervalSinceNow:[[NSTimeZone localTimeZone] secondsFromGMT]];

    NSString *strDate = [dateFormatter stringFromDate:currentDateTimeWithOffset];
    NSDate * now = [dateFormatter dateFromString:strDate];
NSDate *date = [dateFormatter dateFromString:@"2013-04-09 12:10:18"];

NSLog(@"Difference %f",[now timeIntervalSinceDate:date]);

```

And the result is the following : 

```
 Difference 864.000000
 NOW 2013-04-09 15:24:42 +0000
 LAST DATE 2013-04-09 12:10:18

```

Is that correct? the Difference is in Seconds?

Answer: 
If the format gets more complex than the one you've shown, consider using NSDateFormatter. For the simple example:

```
NSArray *hoursMins = [timeString componentsSeparatedByString:@":"];
NSInteger timeInMins = [hoursMins[0] intValue] * 60 + [hoursMins[1] intValue];

```

Then subtract the two times in minutes. The date formatter approach looks like this:

```
NSDateFormatter *df = [[NSDateFormatter alloc] init];
[df setDateFormat:@"HH:mm"];
NSDate *date = [df dateFromString:timeString];

```

You can get a difference in seconds between two dates using:

```
[date timerIntervalSinceDate:anotherDate];

```
NSDateFormatter is the "clean" way to do it. But if you are looking for quick and dirty, and those are the actual strings you are getting (that include the NOW and LAST TIME), I'd just use a specific NSRange to pull the hours and minutes out and compare them.

Make sure, though that you check the hours, and if the "now" hour is before the "last time" hour, you add 24 to the now to throw in the day rollover.