Re: NSDateFormatter problem
Re: NSDateFormatter problem
- Subject: Re: NSDateFormatter problem
- From: Lorenzo Thurman <email@hidden>
- Date: Fri, 20 Apr 2012 13:16:19 -0500
On Apr 20, 2012, at 9:32 AM, Keary Suska wrote:
> On Apr 20, 2012, at 6:08 AM, Lorenzo Thurman wrote:
>
>> On Apr 19, 2012, at 10:18 PM, Keary Suska wrote:
>>
>>>
>>> Perhaps this excerpt from the API doc is key: "Do not use these constants if you want an exact format." Why, might be academic, but if you require a specific style, you may want to specify the style specifically.
>>>
>> I have tried using strings to specify the styles, but no luck.
>
> It is next to impossible that specifying a fixed format will not render the precisely requested results, except programmer error. We can't tell you what you are doing wrong if you don't show us what you are doing.
>
>> Is there a way to reset the Language and Text Preferences? Is there an associated Preferences I can throw away?
>
> I think it is part of com.apple.systempreferences.plist in ~/Library/Preferences. You can test that by dragging it to the desktop and restarting.
>
> Keary Suska
> Esoteritech, Inc.
> "Demystifying technology for your home or business"
>
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
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.
"...Business! Mankind was my business. The common welfare was my business; charity, mercy, forbearance, and benevolence, were all my business. The dealings of my trade were but a drop of water in the comprehensive ocean of my business!"
Marly's ghost - A Christmas Carol
Lorenzo Thurman
email@hidden
_______________________________________________
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