尝试将以下字符串转换为 NSDate - 我认为我的 DateFormatter 设置正确,但它不起作用:
NSString *dateToCheckString = @"Friday, Dec. 6, 2013 at 7:00 PM";
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"eeee, MMM. dd, yyyy at hh a"];
NSDate *dateToCheckNSDate = [[NSDate alloc] init];
dateToCheckNSDate = [dateFormatter dateFromString:dateToCheckString];
// Log it out to see the result:
NSLog(@"Conversion yielded: '%@'", [dateToCheckNSDate description]);
我得到的输出是(null)
有任何想法吗?