类似于下面这样:日期在十天之内:
NSDate *endDate = [[NSDate date] retain]; NSTimeInterval timeInterval= [endDate timeIntervalSinceReferenceDate]; timeInterval -=3600*24*10; NSDate *beginDate = [[NSDate dateWithTimeIntervalSinceReferenceDate:timeInterval] retain]; //对coredata进行筛选(假设有fetchRequest) NSPredicate *predicate_date = [NSPredicate predicateWithFormat:@"date >= %@ AND date <= %@", beginDate,endDate]; [fetchRequest setPredicate:predicate_date]; //释放retained的对象 [endDate release]; [beginDate release];