1.获取当天时间
NSDate *currentDate = [NSDate date];
2.获取第二天或第n天时间
NSTimeInterval secondsPerDay = 24 * 60 * 60;
//获取n天前或n天后,改变TimeInterval数值
NSDate *tomorrowDate = [currentDate dateByAddingTimeInterval:secondsPerDay];
3.提取NSDate中的年月日
NSDateFormatter *formatter = [[NSDateFormatter alloc]init];
[formatter setDateFormat:@"yyyy"]; //month:@"MM", day:@"dd", hour:@"hh", minute:@"mm"
NSString *year = [NSString stringWithFormat:@"%@",[formatter stringFromDate:date]];