I have the following string: NSString *dateStr = @"2010-01-15"; which I’m trying to convert to January, 15th, 2010.
I’m currently using the following code, but it’s returning (null).
NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
[dateFormat setDateFormat:@"MMMM d, YYYY"];
NSDate *date = [dateFormat dateFromString:dateStr];
[dateFormat release];
incidentDate.text = [NSString stringWithFormat:@"%@", date];
Any advice? Thanks in advance!!
Modify your code as given below, will give you desired result.