开发者

How To Parse "Wed Sep 13 16:42:35 +0000 2010" in Objective C

There 开发者_StackOverflow社区just isn't a unicode format for representing months in 3 characters. It is always Sept, which is done by using MMM. What about "Sep"?


NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"EEE MMM dd HH:mm:ss ZZZZ yyyy"];
NSDate *myDate = [dateFormatter dateFromString:@"Wed Sep 13 16:42:35 +0000 2010"];

this should parse your sample string nicely. I have tested it with "Sept" (four characters), it will not work. but "Sep" is just fine.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜