//获取当前年份, 月份, 号数
unsigned unitFlags = NSYearCalendarUnit |NSMonthCalendarUnit |NSDayCalendarUnit;
NSDateComponents *components = [calendar components:unitFlags fromDate:[NSDate date]];
NSLog(@"%ld, %ld, %ld", (long)components.year, (long)components.month, (long)components.day);
网友评论