In my app, I get data from Webservices. The data comes in form of a XML and I use a parser to parse and get the data I need.
In one of the result, I get the date as 14 DEC 2011. However I would like to display the date as 2011-14-12.
Here is the code I use..
NSDate *endDate = [CommonHelper getDateFromString:[NSString stringWithString:elementValue] :@"dd-MMM-yyyy HH:mm:ss"];
+ (NSDate *) getDateFromString: (NSString *) dateStr: (NSString *) format
{
    NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
    [dateFormat setDateFormat:format]; 
    NSDate *newDate = [dateFormat dateFromString:dateStr];
    [dateFormat release];
    return newDate;
}
Would someone be able to help me with how I can do this?