标签:
代码:
- (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. NSLog(@"现在所在的周:%@",[self getWeekFromLocal]); } //活的现在的周的日期,格式:Wednesday -(NSString*)getWeekFromLocal{ NSDate * senddate=[NSDate date]; NSDateFormatter *dateformatter=[[NSDateFormatter alloc] init]; [dateformatter setDateFormat:@"EEEE"]; NSString * locationString=[dateformatter stringFromDate:senddate]; NSLog(@"locationString:%@",locationString); return locationString; }
输出:
2015-03-11 15:50:31.628 获得现在的周[5165:203827] locationString:Wednesday
2015-03-11 15:50:31.648 获得现在的周[5165:203827] 现在所在的周:Wednesday
标签:
原文地址:http://www.cnblogs.com/yang-guang-girl/p/4330145.html