How to get the Next 15 days date depending on current day date?
ios, iphone, objective-c
Solution
Try this:
NSCalendar* calendar = [[[NSCalendar alloc] initWithCalendarIdentifier: NSGregorianCalendar] autorelease];
NSDateComponents* components = [[[NSDateComponents alloc] init] autorelease];
components.day = 15;
NSDate* newDate = [calendar dateByAddingComponents: components toDate: self.date options: 0];
Problem
Currently i am able to get current date of the iPhone by using following code ``` NSDate* date = [NSDate date]; NSDateFormatter* formatter = [[NSDateFormatter alloc] init]; [formatter setDateFormat:@"yyyy-MM-dd"]; NSString* currentDateStr = [formatter stringFromDate:date]; NSLog(@"User's current Date:%@",currentDateStr); ``` but i want get Next 15 days date from current date, how i can get get that?