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;
}
私はこのコードを持っており、コードで与えた結果が真であることを期待しています。しかし、私は間違っています。私の目的は、開始時刻と終了時刻の間の現在の時間を確認することです。私を助けてください。