Tutorial :HTTP date format to NSDate



Question:

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.)


Solution:1

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.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »