我试图从 NSString 转换为 NSdate 但它没有工作。请参阅我的代码。它的输出为“1991-01-04 18:30:00 +0000”。谁能帮我。提前致谢
NSString *selectedDateString =@"03/28/1991";
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"MM/DD/YYYY"];
[dateFormatter setLocale:[[NSLocale alloc] initWithLocaleIdentifier:@"en-US"]];
[dateFormatter setTimeZone:[NSTimeZone systemTimeZone]];
NSDate * selectedDate = [dateFormatter dateFromString:selectedDateString];
NSLog(@"selectedDate-->%@",selectedDate);