I got a NSString *string = @"2012-10-24 23:00:00 +0000";
And I want to convert that to a normal format 24 october 2012
I use the following code. But it keeps crashing. Can anyone help me?
NSDateFormatter *dateformat = [[NSDateFormatter alloc] init];
[dateformat setDateFormat:@"yyyy MM dd HH:mm:SS zzz"];
NSDate *dateNS = [dateformat dateFromString:date];
[dateformat setDateFormat:@"dd MM yyyy"];
date = [dateformat stringFromDate:dateNS];
[dateformat release]
It keeps crashing because it can’t create the
NSDatefrom the input date because the dateformat is incorrect. it missing the-between the date and the seconds aressnotSS.Also you need a date formate with
MMMMto get the months full name: