/**
- 判断当前时间是否处于某个时间段内
- @param startTime 开始时间
- @param endTime 结束时间
- */
- (BOOL)validateWithStartTime:(NSString *)startTime withExpireTime:(NSString *)endTime { NSDate *today = [NSDate date]; NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init]; [dateFormat setDateFormat:@"yyyy-MM-dd HH:mm"]; NSDate *start = [dateFormat dateFromString:startTime]; NSDate *end = [dateFormat dateFromString:endTime]; if ([today compare:start] == NSOrderedDescending && [today compare:end] == NSOrderedAscending) { return YES; } return NO; }
标签:dateFormat,IOS,NSDate,时间段,startTime,某个,endTime,today From: https://www.cnblogs.com/OIMM/p/16978908.html