I am trying to figure out whether or not the current date falls within a date range using NSDate.
For example, you can get the current date/time using NSDate:
NSDate rightNow = [NSDate date];
I would then like to use that date to check if it is in the range of 9AM - 5PM.
I came up with a solution. If you have a better solution, feel free to leave it and I will mark it as correct.
+ (BOOL)date:(NSDate*)date isBetweenDate:(NSDate*)beginDate andDate:(NSDate*)endDate
{
if ([date compare:beginDate] == NSOrderedAscending)
return NO;
if ([date compare:endDate] == NSOrderedDescending)
return NO;
return YES;
}