How long have you been alive solution

NSDateComponents *comps = [[NSDateComponents alloc] init];
        [comps setYear: xxxx];
        [comps setMonth: x];
        [comps setDay: xx];
        NSCalendar *g = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
        NSDate *dateOfBirth = [[NSDate alloc] init];
        dateOfBirth = [g dateFromComponents:comps];
        NSDate *nowInSeconds =[[NSDate alloc] init];
        double seconds = [nowInSeconds timeIntervalSinceDate:dateOfBirth];
        NSLog(@"The amount of seconds since my birth %.2f", seconds);

x’s being your numbers.

probably not the cleanest but I got it to run.

[quote=“endertw”] NSDateComponents *comps = [[NSDateComponents alloc] init]; [comps setYear: xxxx]; [comps setMonth: x]; [comps setDay: xx]; NSCalendar *g = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar]; NSDate *dateOfBirth = [[NSDate alloc] init]; dateOfBirth = [g dateFromComponents:comps]; NSDate *nowInSeconds =[[NSDate alloc] init]; double seconds = [nowInSeconds timeIntervalSinceDate:dateOfBirth]; NSLog(@"The amount of seconds since my birth %.2f", seconds);
x’s being your numbers.

probably not the cleanest but I got it to run.[/quote]

Mine looks pretty much the same due to the example in the book but since we’re on the subject of nesting, I went this route: