On Jun 30, 2009, at 3:29 PM, Trygve Inda wrote:
NSString* myDateFormat = @"%a %b %e %H:%M:%S %Z %Y";
NSDate* myDate = nil;
// myDateString is "Tue Jun 30 15:53:24 UTC 2009"
myFormatter = [[NSDateFormatter alloc]
initWithDateFormat:imageDateFormat
allowNaturalLanguage:NO];
myDate = [myFormatter dateFromString:myDateString];
This works on my English OS, but if I set the Number format to German,
myDate is nil. Why?
It's not clear what you mean by setting the Number format. What value
are you setting and where?
If I am supplying the string format, and the string is correct, how
do I fix
it? Is it because "Tue" is English?
Almost certainly -- "Tue" is not a German abbreviation...
How can I force it to parse in English as my string will always be
English?
Do you need to support pre-10.4 systems?
You are strongly encouraged to adopt the 10.4+ behaviour for
formatters. You can then easily set a specific locale for the
formatter.
See <http://developer.apple.com/DOCUMENTATION/Cocoa/Conceptual/DataFormatting/Articles/dfDateFormatting10_4.html#//apple_ref/doc/uid/TP40002369
> (note in particular the references to the Unicode string format
standards).
mmalc
_______________________________________________
Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to arch...@mail-archive.com