[Solved] NSDateFormatter returning nil with dateFromString


NSString *trimmedDOB=@"1992-11-15";
NSDateFormatter *format = [[NSDateFormatter alloc] init];

//Set your input format
[format setDateFormat:@"yyyy-MM-dd"];

//Parse date from input format
NSDate *dateOfBirth = [format dateFromString:trimmedDOB];

//Set your output format
[format setDateFormat:@"MM-dd-yyyy"];

//Output date in output format
NSLog(@"DATE IS %@",[format stringFromDate:dateOfBirth]);

0

solved NSDateFormatter returning nil with dateFromString