I'm a little late for the party but anyway, here it goes:
NSDate *today = [NSDate date];
NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
[dateFormat setDateFormat:@"DDD"];
NSInteger dayInYear = [[dateFormat stringFromDate:today] integerValue];
NSLog(@"today is %d. day in year", dayInYear);
result for 14.jun.2012: today is 166. day in year
EDIT: i was amazed that there was no easy-to-find example on Google.
You could also use format @"DD"
to get day in month or @"D"
to get day in week.
EDIT2: Just a note: creating NSDateFormatter
can be quite expensive operation. If your class uses this function frequently you might want to create a static formatter ivar.