首页 > 代码库 > IOS 计算N天之后的时间

IOS 计算N天之后的时间

+ (NSDate *)dateAfterDays:(int)days{        NSCalendar *calendar = [NSCalendar currentCalendar];        unsigned unitFlags = NSYearCalendarUnit | NSMonthCalendarUnit |  NSDayCalendarUnit;        NSDateComponents *components = [calendar components:unitFlags fromDate:[NSDate date]];        [components setDay:([components day]+days)];    return [calendar dateFromComponents:components];}

 

IOS 计算N天之后的时间