Last active
August 29, 2015 13:56
-
-
Save zhugexiaobo/9130469 to your computer and use it in GitHub Desktop.
比较2个 NSDate
This file contains 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
if ([date1 compare:date2] == NSOrderedDescending) { | |
NSLog(@"date1 is later than date2"); | |
} else if ([date1 compare:date2] == NSOrderedAscending) { | |
NSLog(@"date1 is earlier than date2"); | |
} else if ([date1 compare:date2] == NSOrderedSame) { | |
NSLog(@"dates are the same"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment