Re: NSDateFormatter problem
Re: NSDateFormatter problem
- Subject: Re: NSDateFormatter problem
- From: Keary Suska <email@hidden>
- Date: Fri, 20 Apr 2012 14:47:43 -0600
On Apr 20, 2012, at 12:16 PM, Lorenzo Thurman wrote:
> I agree. This should not happen, but here is my original code:
> -(NSString*)formattedDate:(NSDate*)aDate{
>
> NSDateFormatter * formatter = [[NSDateFormatter alloc] init];
> [formatter setDateFormat:@"mm-dd-yyyy hh:mm a"];
>
>
> NSString * dateString = [formatter stringFromDate:aDate];
>
> return [self stringWithSentenceCapitalization:dateString];
> }
> and it produces the incorrect format.
> It is called like this:
>
> [weathervane formattedDate:[timer fireDate]];
>
> [timer fireDate]
> returns a date in this format:
> 2012-04-20 18:23:43 +0000
This may be because the format is invalid, although I wouldn't have thought so. It should be: @"MM-dd-yyy hh:mm a". Might be worth a try.
For giggles, what does -[formatter formatterBehavior] return? Does setting it explicitly to NSDateFormatterBehavior10_4 change anything?
> I've also rebuilt the revision of the source for the old build that I have and it produces the same flawed results.
> In any case, I'll edit the global prefs and see if it makes a difference. I really hope that I made an error somewhere. Thats a problem I can fix.
Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"
_______________________________________________
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