1

2012-05-02T15:44:20.000Z是什么格式

我一直试图让它解析,但在这部分有一些问题。

NSString *articleDateString = [item valueForChild:@"published"];
        NSDate *articleDate = [NSDate dateFromInternetDateTimeString:articleDateString formatHint:DateFormatHintRFC822];
        NSDateFormatter * dateFormatter = [[[NSDateFormatter alloc] init] autorelease];
        [dateFormatter setTimeStyle:NSDateFormatterShortStyle];
        [dateFormatter setDateStyle:NSDateFormatterShortStyle];
        NSString *dateofarticle = [dateFormatter stringFromDate:articleDate];

它不是 RFC822。这就是我所知道的一切。

4

1 回答 1

0
NSString *articleDateString = [item valueForChild:@"published"];
NSDate *articleDate = [NSDate dateFromInternetDateTimeString:articleDateString formatHint:DateFormatHintRFC822];
NSDateFormatter * dateFormatter = [[[NSDateFormatter alloc] init] autorelease];
[dateFormatter setDateStyle:@"yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'SSS'Z'"];
NSString *dateofarticle = [dateFormatter stringFromDate:articleDate];
于 2013-01-21T06:40:09.910 回答