I want to compare 2 specific days, but, i want to compare month and year, not days. For example, i got one date something like 2016-08-16, and other date like 2016-08-10, i need to compare dates and got equality, because their month are equal.
Therefore, i need a way to make both NSDates with equal days, so i need to make 2016-08-10 to be 2016-08-00. After that i can modify second date as well and make comparison.
I have simple code snipper for equality, but i suppose it consider days and hours, etc. as well:
if ([dateOld compare:dateNew] == NSOrderedDescending) {
NSLog(@"date1 is later than date2");
} else if ([dateOld compare:dateNew] == NSOrderedAscending) {
NSLog(@"date1 is earlier than date2");
} else {
NSLog(@"dates are the same");
}
To make it work i need to "zero" days and time of NSDates. Is there any way to do that?