NSDate *date = [NSDate date];
NSDateFormatter *dateFormat = [[NSDateFormatter alloc]init];
[dateFormat setDateFormat:@"MM/dd/yyyy"];
NSLog([@"today is " stringByAppendingString:[dateFormat stringFromDate:date]]);
NSLog([@"firstBirthdayDate is " stringByAppendingString:[dateFormat stringFromDate:firstBirthdayDate]]);
NSLog([@"secondBirthdayDate is " stringByAppendingString:[dateFormat stringFromDate:secondBirthdayDate]]);
if ([firstBirthdayDate isEqualToDate:secondBirthdayDate])
NSLog(@"First date is the same as second date");
if (firstBirthdayDate < date)
NSLog(@"First date is earlier than today");
else
NSLog(@"First date is later than today");
if (secondBirthdayDate < date)
NSLog(@"Second date is earlier than today");
- Today is 11/08/2012
firstBirthdayDate
is 01/23/2012secondBirthdayDate
is 01/23/2012
Here's what I get in the log:
First date is the same as second date
First date is later than today
Second date is earlier than today
I think I'm going crazy...