【发布时间】:2016-02-24 10:48:24
【问题描述】:
NSString *string = [NSString stringWithFormat:@"%@-%ld %@",self.date,(long) [self getYear],self.time];
NSDateFormatter *dateFormat = [[NSDateFormatter alloc]init];
[dateFormat setDateFormat:@"EEE, MMM-dd-YYYY hh:mm"];
NSDate *date = [dateFormat dateFromString:string];
NSLog(@"date: %@",date);
如果我输入:Mon, Feb-29-2016 9:00
我从 2015-12-21 03:30:00 +0000
得到一个输出与实际日期相差甚远
【问题讨论】:
-
第一行执行后
string的值是多少?
标签: ios objective-c nsdate nsdateformatter