Re: dateFromString won't accept this string:

2015-11-23 Thread Sandor Szatmari
Alex, Have you tried looking at NSDataDetector. http://nshipster.com/nsdatadetector/ Sandor > On Nov 22, 2015, at 16:12, Alex Hall wrote: > > Hey list, > I’m using NSDateFormatter.dateFromString() to make a date from the date > string in a tweet. However, it seems to be

Re: dateFromString won't accept this string:

2015-11-23 Thread Alex Hall
> On Nov 23, 2015, at 8:00 AM, Sandor Szatmari > wrote: > > Alex, > > Have you tried looking at NSDataDetector. > http://nshipster.com/nsdatadetector/ Thanks for the suggestion. I don't think that would apply here, though;

Re: dateFromString won't accept this string:

2015-11-23 Thread Alex Zavatone
Have you looked into The spec for date formatting? It is seriously helpful. It's some ISO document. Specify the format at which the date is coming in and it should convert. I will send you my crappy routines for this for iOS. Sent from my iPhone > On Nov 23, 2015, at 9:06 AM, Alex Hall

Re: dateFromString won't accept this string:

2015-11-23 Thread Alex Zavatone
There is some ISO spec for date formatting that Apple’s docs mention IIRC. Let me sniff around. http://www.w3.org/TR/NOTE-datetime Also, from Apple’s docs: “ The format string uses the format patterns from the Unicode Technical Standard #35” Don’t go there. It will hurt you. I’ve added a

Re: dateFromString won't accept this string:

2015-11-23 Thread Shane Stanley
On 24 Nov 2015, at 9:26 AM, Alex Zavatone wrote: > > Here’s a pretty good (really really good) reference: Except it's out-of-date. -- Shane Stanley

Re: dateFromString won't accept this string:

2015-11-23 Thread Sandor Szatmari
Alex, What spec are you referring to? Link? I was playing around with NSDataDetector for pulling dates out of strings in XML dumps of excel files for an internal tool I was writing. NSDataDetectors seemed powerful, but failed when the dates weren't totally well formed (Tested on 10.8.5, SDK

Re: dateFromString won't accept this string:

2015-11-23 Thread Alex Hall
> On Nov 23, 2015, at 4:32 PM, Sandor Szatmari > wrote: > > Alex, > > What spec are you referring to? Link? I was playing around with > NSDataDetector for pulling dates out of strings in XML dumps of excel files > for an internal tool I was writing.

Re: dateFromString won't accept this string:

2015-11-22 Thread Alex Hall
> On Nov 22, 2015, at 6:04 PM, Alex Hall wrote: > > >> On Nov 22, 2015, at 5:06 PM, Jerry Krinock wrote: >> >> >>> On 2015 Nov 22, at 13:12, Alex Hall wrote: >>> >>> Is there something else I have to do, like tell the formatter what

Re: dateFromString won't accept this string:

2015-11-22 Thread Jerry Krinock
> On 2015 Nov 22, at 21:12, Alex Hall wrote: > I'd still be curious to know about templates, but this works so I won't > spend time on it right now. The answer, with an example of why you might want to use templates, is explained in Data Formatting Programming Guide >

Re: dateFromString won't accept this string:

2015-11-22 Thread Alex Hall
> On Nov 22, 2015, at 5:06 PM, Jerry Krinock wrote: > > >> On 2015 Nov 22, at 13:12, Alex Hall wrote: >> >> Is there something else I have to do, like tell the formatter what order to >> expect components to be in? > > Yes, and more. You must set the

dateFromString won't accept this string:

2015-11-22 Thread Alex Hall
Hey list, I’m using NSDateFormatter.dateFromString() to make a date from the date string in a tweet. However, it seems to be returning nil, and I’m not sure why. Is there something else I have to do, like tell the formatter what order to expect components to be in? The string is something like:

Re: dateFromString won't accept this string:

2015-11-22 Thread Jerry Krinock
> On 2015 Nov 22, at 13:12, Alex Hall wrote: > > Is there something else I have to do, like tell the formatter what order to > expect components to be in? Yes, and more. You must set the dateFormat property of your date formatter exactly. Documentation of property