comparision:

NSComparisonResult result;
//has three possible values: NSOrderedSame,NSOrderedDescending, NSOrderedAscending

result = [today compare:yourDate]; // comparing two dates
NSLog(@"%ld",(long)result);
NSLog(@"%@",today);
if(result==NSOrderedAscending)
NSLog(@"today is less");
else if(result==NSOrderedDescending)
NSLog(@"newDate is less");
else
NSLog(@"Both dates are same");
Previous
Next Post »