if([date1 compare:date2]== NSOrderedDescending){NSLog(@"date1 is later than date2");}elseif([date1 compare:date2]== NSOrderedAscending){NSLog(@"date1 is earlier than date2");}else{NSLog(@"dates are the same");}
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");}