Hello all, I'm new to the forum and to Objective C, but not to programming in general.
Can anyone give me some tips here?
Can anyone give me some tips here?
Code:
#import <Foundation/Foundation.h>
int main (int argc, const char * argv[]) {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSDateComponents *comps = [[NSDateComponents alloc] init];
[comps setDay:1];
[comps setMonth:7];
[comps setYear:1984];
NSLog(@"comps at this point is %Lf", comps);
NSCalendar *g = [[NSCalendar alloc]initWithCalendarIdentifier:NSGregorianCalendar];
NSDate *dateofbirth = [g dateFromComponents:comps];
NSDate *now = [NSDate date];
double timeSince = [dateofbirth timeIntervalSinceDate: now ];
NSLog(@"your age %d", timeSince);
[pool drain];
return 0;
}