Created
August 31, 2014 13:21
-
-
Save lfaoro/c8d63a58ae26df2f24ff to your computer and use it in GitHub Desktop.
test
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 *now = [NSDate date]; | |
NSDateFormatter *format = [[NSDateFormatter alloc]init]; | |
[format setDateFormat:@"yyyy-MM-dd"]; | |
NSString *nowDate = [format stringFromDate:now]; | |
NSLog(@"test: %@",nowDate); | |
NSDateComponents *comps = [[NSDateComponents alloc] init]; | |
[comps setDay:27]; | |
[comps setMonth:9]; | |
[comps setYear:1988]; | |
NSCalendar *local = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar]; | |
NSDate *birthDay = [local dateFromComponents:comps]; | |
double difference = [now timeIntervalSinceDate:birthDay]; | |
double years = (((difference /60) /60) /24) /365; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment