How would I compare only the year-month-day components of 2 NSDates
?
Check out this topic NSDate get year/month/day
Once you pull out the day/month/year, you can compare them as integers.
If you don't like that method
Instead, you could try this..
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"yyyy"];
int year = [[dateFormatter stringFromDate:[NSDate date]] intValue];
[dateFormatter setDateFormat:@"MM"];
int month = [[dateFormatter stringFromDate:[NSDate date]] intValue];
[dateFormatter setDateFormat:@"dd"];
int day = [[dateFormatter stringFromDate:[NSDate date]] intValue];
And another way...
NSDateComponents *dateComp = [calendar components:unitFlags fromDate:date];
NSInteger year = [dateComp year];
NSInteger month = [dateComp month];
NSInteger day = [dateComp day];