for (int i=0; i<7; i++) {
NSDate *nowDate = [NSDatedate];
NSDateFormatter *dateFormatter = [[NSDateFormatteralloc]init];
if (i == 6)
{
[dateFormattersetDateFormat:@"MM月dd日"];
}else
{
[dateFormattersetDateFormat:@"dd"];
}
NSDate *timeDate = [NSDatedateWithTimeInterval:-(i+1)*24*60*60sinceDate:nowDate];//前一天
NSString *timeString = [dateFormatter
stringFromDate:timeDate];
NSLog(@"lastDay:%@",timeString);
}
版权声明:本文为博主原创文章,未经博主允许不得转载。
时间: 2024-10-27 08:30:36