Re: NSDate from xsd:dateTime / ISO 8601
Re: NSDate from xsd:dateTime / ISO 8601
- Subject: Re: NSDate from xsd:dateTime / ISO 8601
- From: Jens Alfke <email@hidden>
- Date: Mon, 17 Mar 2008 18:07:54 -0700
On 17 Mar '08, at 4:30 PM, Nathan Vander Wilt wrote:
This works, BUT...I had to edit the format a bit because my time
strings (in this sample!) did not have the decimal seconds. However,
I wouldn't be surprised to see input with sub-second precision. How
can I specify optional format parts?
I don't think you can. You can work around it by trying both formats
in sequence. (No joke — you should see the date parsing code in
PubSub. It tries about 30 different date formats one after the other,
to handle all the crazy mistakes people make in generating RSS feeds.)
As it is, I might as well get rid of the hasSuffix checking and put
a quoted 'Z' in the format, since that is actually far less likely
to change than the seconds part in this case
You can do that, but then of course you'll fail to parse dates that do
have a timezone...
—Jens
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden