IOS获取两个日期之间的时间间隔
NSString *formeDateString = @"2016-01-1"; NSDate *nowDate = [NSDate date]; NSDateFormatter *dateFormate = [[NSDateFormatter alloc]init]; [dateFormate setDateFormat:@"yyyy-MM-dd"]; NSDate *formeDate = [dateFormate dateFromString:formeDateString]; NSCalendar *dateCalendar = [[NSCalendar alloc]initWithCalendarIdentifier:NSCalendarIdentifierGregorian]; NSDateComponents *components = [dateCalendar components:NSCalendarUnitDay fromDate:formeDate toDate:nowDate options:NSCalendarWrapComponents];