iOS-OC-判斷某個時間是否處於某個時間段內

ZFJ_張福傑發表於2016-02-17

#pragma mark - 判斷時間段
- (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;
}


相關文章