What's the best/easiest way to compare two times in Objective-C?

Posted by Andy on Stack Overflow See other posts from Stack Overflow or by Andy
Published on 2010-05-10T17:18:34Z Indexed on 2010/05/10 17:34 UTC
Read the original article Hit count: 216

Filed under:
|

I've got a string representation of a time, like "11:13 AM." This was produced using an NSDateFormatter and the stringFromDate: method.

I'd like to compare this time to the current time, but when I use the dateFromString: method to turn the string back into a date, a year, month and day are added - which I don't want. I just need to know if right now is < or > the time stored in the string.

What's going to be the best way to handle that? Thanks in advance for your help.

© Stack Overflow or respective owner

Related posts about iphone-sdk

Related posts about objective-c