Re: NSDateFormatter returns nil
Re: NSDateFormatter returns nil
- Subject: Re: NSDateFormatter returns nil
- From: Fritz Anderson <email@hidden>
- Date: Fri, 12 Feb 2010 13:21:04 -0600
On 12 Feb 2010, at 12:16 PM, Kristof Van Landschoot wrote:
> Why is lDateFormatted nil on iPhone simulator 3.1.2 after executing
> this piece of code?
>
> NSString *lDateString = @"Wed, 17 Feb 2010 16:02:01";
> NSDateFormatter* dateFormatter = [[[NSDateFormatter alloc] init]
> autorelease];
> [dateFormatter setDateFormat:@"EEE, dd MMM yyyy hh:mm:ss"];
> NSDate *lDateFormatted = [dateFormatter dateFromString: lDateString ];
>
> Any ideas appreciated, Thanks
Next investigational step: Try the formatter in reverse. Written in Mail:
NSString * formatted = [dateFormatter stringFromDate: [NSDate date]];
NSLog(@"It is now %@", formatted);
Does it print in the format you expect?
— F
_______________________________________________
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