HTTP date format to NSDate?

Up vote 0 down vote favorite share g+ share fb share tw.

I have a date string (well, NSData, but that's easy to convert to a string) that's in what I believe is the format the HTTP standard uses: Mon Apr 17 19:34:46 UTC 2006 Is there any better (i.e. Less error-prone) way to parse that than specifying the format string by hand in an NSDateFormatter? (My application is an iPhone app, but I suspect standard Cocoa solutions will work too, since NSDate and NSDateFormatter are part of Foundation.

) iphone cocoa cocoa-touch nsdate foundation link|improve this question asked Mar 15 '09 at 4:35Brent Royal-Gordon4,0841824 100% accept rate.

– Alexandre L Telles Mar 15 '09 at 13:13 @Alexandre L Telles he doesn't have a NSDat*e*, but NSDat*a*, with a date string inside. – ax. Mar 15 '09 at 13:41.

No, I don't think there is a better way. If you have some outside input, you must know the format of your input beforehand, and you can only prepare for problems, i.e. A fail over parser with an alternate NSDateFormatter.

I thought that might be the case. Thanks anyway. – Brent Royal-Gordon Mar 15 '09 at 15:45.

Actually the standard HTP date format is: "Mon, 11 May 2009 02:49:52 GMT.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions