This is my JSON
{
0 = "2011-11-11";
1 = "2011-12-31";
endDate = "2011-12-31";
startDate = "2011-11-11";
}
My code is
NSString *dateString = [jsonDict objectForKey:@"0"]
// Convert string to date object
NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
[dateFormat setDateFormat:@"EE, d LLLL yyyy HH:mm:ss Z"];
NSDate *date = [dateFormat dateFromString:dateString];
[dateFormat release];
But this code is not working.
How do I convert JSON data into date format?
You’re using the wrong format in
setDateFormat. You should be using: