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;
}
我有这个代码,我期待结果是我在代码中给出的。但我得到的是错误的。我的目标是在开始时间和结束时间之间检查我的当前时间。请帮我。