标签:nsdate
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);
}
版权声明:本文为博主原创文章,未经博主允许不得转载。
标签:nsdate
原文地址:http://blog.csdn.net/levebe/article/details/48055105