日期字符串加月

NSDateFormatter* dateFormat = [[NSDateFormatteralloc]init];

[dateFormatsetDateFormat:@"yyyy-MM-dd"];

NSDate*date =[dateFormatdateFromString:self.model.starttime];

NSCalendar*gregorian = [[NSCalendaralloc]

initWithCalendarIdentifier:NSGregorianCalendar];

NSDateComponents* dc1 = [[NSDateComponentsalloc]init] ;

[dc1setMonth:[self.model.longtimeintValue]];

NSDate*nextYearDate = [ gregoriandateByAddingComponents:dc1toDate:dateoptions:0];

_mingxiV.touzizhongzhishijian.text= [NSStringstringWithFormat:@"投资终止时间: %@",[dateFormatstringFromDate:nextYearDate]];

你可能感兴趣的:(日期字符串加月)