Possible Duplicate:
how to convert datetime format in NSString?
I have stored date in string from json parsing. The format of date is 2011-1-24. Now i want to convert into MM-dd-YYYY format. For that i am using this code
NSString *stringDate =[NSString stringWithFormat:@"%@",[list_date objectAtIndex:indexPath.row]];
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"MM-dd-yyyy"];
NSDate *date = [dateFormatter dateFromString:stringDate];
NSString *newDate = [dateFormatter stringFromDate:date];
But it show null value. What is problem in this code?
Thanks in advance...