Created
August 8, 2012 07:53
-
-
Save es-kumagai/3293276 to your computer and use it in GitHub Desktop.
Get a date that after some weeks from a date. (iOS, Xcode 4.4.1, ARC)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (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