• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSDateFormatter Breaks on non-English OS
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSDateFormatter Breaks on non-English OS


  • Subject: Re: NSDateFormatter Breaks on non-English OS
  • From: Trygve Inda <email@hidden>
  • Date: Tue, 30 Jun 2009 23:10:11 +0000
  • Thread-topic: NSDateFormatter Breaks on non-English OS

>
> 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?
>

My string will always be of the format: "Tue Jun 30 15:53:24 UTC 2009"

Thus

NSString*      myDateFormat = @"%a %b %e %H:%M:%S %Z %Y";;
NSString*      myDateString = @"Tue Jun 30 15:53:24 UTC 2009";

myFormatter = [[NSDateFormatter alloc] initWithDateFormat:imageDateFormat
allowNaturalLanguage:NO];

myDate = [myFormatter dateFromString:myDateString];

myDate stay nil on non English Oss.

Even if I add the short abbreviations to the formatter.


_______________________________________________

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

  • Follow-Ups:
    • Re: NSDateFormatter Breaks on non-English OS
      • From: Trygve Inda <email@hidden>
References: 
 >Re: NSDateFormatter Breaks on non-English OS (From: mmalc Crawford <email@hidden>)

  • Prev by Date: Dynamic Services menu, CM plug-in alternatives
  • Next by Date: Re: NSRuleEditor
  • Previous by thread: Re: NSDateFormatter Breaks on non-English OS
  • Next by thread: Re: NSDateFormatter Breaks on non-English OS
  • Index(es):
    • Date
    • Thread