I have two NSDate
objects, dateOne
and dateTwo
. If dateTwo
is later than dateone
but on the same day as dateOne
(ex. January 1, 2015 4:00pm and January 1, 2015 5:00pm) then I want to return that they are the same. However, as soon as dateTwo
is on the next day or later (ex. January 1, 2015 and January 2, 2015), I want to return that dateOne
< dateTwo
.
I'm currently trying to accomplish this by doing:
- (BOOL)dateTwoLaterThanDateOne:(NSDate *)dateOne withDateTwo:(NSDate *)dateTwo {
if([dateTwo compare: dateOne] == NSOrderedDescending) // if dateTwo is later in time than dateOne
{
return YES;
}
return NO;
}