First you have to get NSDateComponents object with year, month and day units:
1 |
NSDateComponents *components = [[NSCalendar currentCalendar] components:NSCalendarUnitDay | NSCalendarUnitMonth | NSCalendarUnitYear fromDate:[NSDate date]]; |
then extracting each value is simple:
1 2 3 |
NSInteger day = [components day]; NSInteger month = [components month]; NSInteger year = [components year]; |