Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Get a date that after some weeks from a date. (iOS, Xcode 4.4.1, ARC)
- (NSDate*)dateAfterWeeks:(NSInteger)weeks fromDate:(NSDate*)date
NSCalendar* calendar = [NSCalendar currentCalendar];
NSDateComponents* someWeeksComponent = [[NSDateComponents alloc] init];
someWeeksComponent.week = weeks;
return [calendar dateByAddingComponents:someWeeksComponent toDate:date options:0];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment