NSDate *now = [NSDate date];
NSLog(@"now date is: %@", now);
NSCalendar *calendar = [NSCalendar currentCalendar];
NSUInteger unitFlags = NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit | NSHourCalendarUnit | NSMinuteCalendarUnit | NSSecondCalendarUnit;
NSDateComponents *dateComponent = [calendar components:unitFlags fromDate:now];
NSInteger year = [dateComponent year];
NSInteger month = [dateComponent month];
NSInteger day = [dateComponent day];
NSInteger hour = [dateComponent hour];
NSInteger minute = [dateComponent minute];
NSInteger second = [dateComponent second];
NSLog(@"year is: %ld", year);
NSLog(@"month is: %ld", month);
NSLog(@"day is: %ld", day);
NSLog(@"hour is: %ld", hour);
NSLog(@"minute is: %ld", minute);
NSLog(@"second is: %ld", second);