知道当前日期计算若干天后的日期

  NSDate *today = [[NSDate alloc] init];
    NSCalendar *cal = [[NSCalendar alloc] initWithCalendarIdentifier:NSCalendarIdentifierGregorian];
    NSDateComponents *components = [[NSDateComponents alloc] init];
    [components setDay:80];
    NSDate *endDay = [cal dateByAddingComponents:components toDate:today options:0];
    NSLog(@"%@",endDay);

你可能感兴趣的:(日期)