Skip to content

Instantly share code, notes, and snippets.

@zhugexiaobo
Last active August 29, 2015 13:56
Show Gist options
  • Save zhugexiaobo/9130469 to your computer and use it in GitHub Desktop.
Save zhugexiaobo/9130469 to your computer and use it in GitHub Desktop.
比较2个 NSDate
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