[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: dateFromString always returns null
From: |
Stefan Bidi |
Subject: |
Re: dateFromString always returns null |
Date: |
Mon, 11 Feb 2013 07:20:54 -0600 |
Slackware 13.37 does not offer ICU in the base distribution so you
will need to get it from SlackBuilds
(http://slackbuilds.org/repository/13.37/libraries/icu4c/).
On Mon, Feb 11, 2013 at 12:35 AM, Richard Frith-Macdonald
<address@hidden> wrote:
>
> On 10 Feb 2013, at 21:01, Steven LeMaire wrote:
>
>> Hi Everyone,
>>
>> I really don't understand why the code below isn't working for me. I've
>> tried setting a locale and timezone on the date formatter, but it's had no
>> affect.
>> I'm running this on Slackware 13.37, I've just updated to the latest stable
>> version of GNUstep also.
>> Any help would be appreciated !
>>
>> Thanks
>> Steven
>>
>> #import <Foundation/Foundation.h>
>> #import <Foundation/NSDate.h>
>> #import <Foundation/NSDateFormatter.h>
>> int
>> main(int argc, const char *argv[]) {
>> NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
>>
>>
>> NSDate *d;
>> NSDateFormatter *df = [[NSDateFormatter alloc] init];
>> [df setDateFormat:@"yyyyMMdd"];
>> d = [df dateFromString:@"20130215"];
>>
>> NSLog(@"d is: %@", d);
>>
>> [pool release];
>>
>> return 0;
>> }
>> _
>
> That looks fine to me ... so my best guess is you built base without support
> for NSDateFormatter.
> That would happen if you are on a system where ICU is not installed or can't
> be found:
> You should have seen a warning about that when you ran 'configure' for the
> base library.
>
> The fix would be to rebuild base with ICU (I don't know slackware, but I
> guess you might need to install an ICU developer package).
>
> A workaround would be to use NSCalendarDate rather than NSDateFormatter
>
>
>
> _______________________________________________
> Gnustep-dev mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/gnustep-dev