开发者

rfc850 date format and NSDateFormatter

Im having a hard tim getting the NSDateFormatter to give me a correct date format. I need it to look like this:

Mon, 04 Jan 2010 10:10:00 GMT

But I am getting:

Mon, 04 Jan 2010 10:10:00 GMT+00:00

Using the format string:

EEE',' dd' 'MMM' 'yyyy HH':'mm':'ss z

No matter what value for timezone I use, the +00:00 appears to be stuck on the end. I realize I could just remove it form th开发者_JAVA百科e resulting string, but that feels like cheating.

So how do I get the date formatter to not include a time offset value?


I had the same problem when generating Http Date in RC1123 format.

http://blog.mro.name/2009/08/nsdateformatter-http-header/

Has some good information, but basically just replaces z with the fixed string 'GMT'.


After much more research, I'm pretty sure this can't be done. So my simple string manipulation will have to do.


actually http://blog.mro.name/2009/08/nsdateformatter-http-header/ shows the correct way to do it, as the RFC allows the literal 'GMT' only and the NSDateFormatter is forced to timezone GMT and english weekday & month names.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜