I have an 2 NSDates
, a startdate
and enddate
. These dates have the following format.
startDate = 2013-02-22 12:00:00 +0000; endDate = 2013-02-25 13:00:00 +0000;
Now I want to compare these dates. Therefore I've this code.
if([event.startDate isEqualToDate:event.endDate]){
NSLog(@"event %@ is in the same day",event.title);
}else{
NSLog(@"event %@ is NOT in the same day",event.title);
}
But the problem is that it always gets in the else-statement. I want that if the startDate and endDate are in the same day,month and year they give me the first NSLog
else they give me the second NSLog
Any help?