So i am parsing an xml file and display on screen the dates that i parse.
The dates are like : Thu , 31 May 2012 20:43:54 GMT.
How can i convert the date to this format : dd/mm/yy ?
i dont need the time.
Well it crashes.
I tried :
NSString *date = [[stories objectAtIndex: storyIndex] objectForKey: @"date"];
//changing dates format
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat: @"yyyy-MM-dd HH:mm:ss Z"];
NSDate *myDate = [dateFormatter dateFromString:date];
NSString *dateText = [[NSString alloc] initWithString:[dateFormatter stringFromDate:myDate]];
Any ideas?
You can use
NSDateFormatterFor example:
See http://unicode.org/reports/tr35/tr35-6.html#Date_Format_Patterns for dateformat patterns