Skip to content

Instantly share code, notes, and snippets.

@dodyw
Created October 27, 2012 06:44
Show Gist options
  • Save dodyw/3963232 to your computer and use it in GitHub Desktop.
Save dodyw/3963232 to your computer and use it in GitHub Desktop.
Compare two NSDate
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