NSDate* firstTime = (NSDate *)openTime;//10:00AM
NSDate* secondTime = (NSDate *)closeTime;//10:00PM
NSDate* nowTime = (NSDate *)str;//3:09PM
NSComparisonResult result1 = [nowTime compare:firstTime];
NSComparisonResult result2 = [nowTime compare:secondTime];
if(result1==NSOrderedDescending && result2==NSOrderedAscending)
{
return TRUE;//------ expecting result is true as per sample
}
else
{
return FALSE;
}
I am having this code and I am expecting result is true that I gave in code. but I am getting is false. My aim is to check my current time between the start time and end time. Please help me.