美文网首页
IOS 获取当前时间之后一个星期的时间

IOS 获取当前时间之后一个星期的时间

作者: 秀_ba75 | 来源:发表于2017-04-28 16:11 被阅读257次

NSDate *date = [NSDate date];

NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];

[dateFormat setDateFormat:@"yyyy年MM月dd日"];// you can use your format.

for (int a = 0; a<7; a++) {

NSDate *nextDate = [NSDate dateWithTimeInterval:24*60*60*a sinceDate:date];

NSString *timeStr = [dateFormat stringFromDate:nextDate];

[_curYearAndDateArr addObject:timeStr];

NSLog(@"============%@",_curYearAndDateArr);

}

相关文章

网友评论

      本文标题:IOS 获取当前时间之后一个星期的时间

      本文链接:https://www.haomeiwen.com/subject/xkcazttx.html