Created
October 27, 2012 06:44
-
-
Save dodyw/3963232 to your computer and use it in GitHub Desktop.
Compare two NSDate
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| NSDate *date1; | |
| NSDate *date2; | |
| if ([date1 compare:date2] == NSOrderedDescending) { | |
| NSLog(@"date1 is later than date2"); | |
| } else if ([date1 compare:date2] == NSOrderedAscending) { | |
| NSLog(@"date1 is earlier than date2"); | |
| } else { | |
| NSLog(@"dates are the same"); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment