在iPhone中转换日期格式

在iPhone中用AFFeedParser解析不同HTML页面的文章

通过解析,获取到的文章日期为字符串:

"Thu, 06 Dec 2012 17:44:22 +0000\n\t\t"

怎么样能把日期转换成这样的格式:Thursday,December 06,2012

请高人指点。

    NSString *yourStringDate = @"Thu, 06 Dec 2012 17:44:22 +0000\n\t\t";
    NSString *str =[yourStringDate stringByReplacingOccurrencesOfString:@"\n" withString:@""];

    str =[str stringByReplacingOccurrencesOfString:@"\t" withString:@""];
    [str retain];

    NSDateFormatter *dateFormatter = [[[NSDateFormatter alloc] init] autorelease];
    [dateFormatter setDateFormat:@"EEE, dd MMM yyyy HH:mm:ss z"];

    NSDate *date = [dateFormatter dateFromString: str];

    dateFormatter = [[[NSDateFormatter alloc] init] autorelease];
    [dateFormatter setDateFormat:@"EEEE,LLLL dd,yyyy"];

    NSString *convertedString = [dateFormatter stringFromDate:date];
    NSLog(@"Converted String : %@",convertedString);

然后输出是: Converted String : Thursday,December 06,2012