Created
April 23, 2013 05:58
-
-
Save hlxwell/5441135 to your computer and use it in GitHub Desktop.
Calculate the age
This file contains hidden or 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* now = [NSDate date]; | |
NSDateComponents* ageComponents = [[NSCalendar currentCalendar] | |
components:NSYearCalendarUnit | |
fromDate:self.birthday | |
toDate:now | |
options:0]; | |
NSInteger age = [ageComponents year]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment