I have to format the date string: Tuesday 4 December 2012
into this format:
2012-12-04
Im using this code, but I don’t know which correct setDateFormat string should I use to get the required result.
NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
[dateFormat setDateFormat:@"dddd d M YYYY"];
NSDate *date = [dateFormat dateFromString:tempDate];
Please help
yyyy-MM-dd (assuming the 12 in your example is the month)
It’s all explained in the NSDateFormatter documentation under “Use Format Strings To Specify Custom Formats”