Skip to content

Instantly share code, notes, and snippets.

@hlxwell
Created April 23, 2013 05:58
Show Gist options
  • Save hlxwell/5441135 to your computer and use it in GitHub Desktop.
Save hlxwell/5441135 to your computer and use it in GitHub Desktop.
Calculate the age
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