代码:
NSString* mydate = @"11/06/2012 19:15:40";
NSLog(@"%@", mydate);
NSDateFormatter* dateFormatter1 = [[NSDateFormatter alloc] init];
dateFormatter1.dateFormat = @"MM-dd-yyyy HH:mm:ss";
NSDate* adate = [dateFormatter1 dateFromString:mydate];
NSLog(@"%@", adate);
日志:
11/06/2012 19:15:40
(null)
为什么我会为空?