• 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 refuses to format dates
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSDateFormatter refuses to format dates


  • Subject: Re: NSDateFormatter refuses to format dates
  • From: "Gerriet M. Denkmann" <email@hidden>
  • Date: Tue, 27 Sep 2011 23:26:11 +0700

On 27 Sep 2011, at 22:03, glenn andreas wrote:

>
> On Sep 27, 2011, at 9:53 AM, Gerriet M. Denkmann wrote:
>
>>>
>>> In general, what happens if you temporarily remove the locale and time zone settings?
>> The time zone settings have been already removed, because setting the locale also sets the time zone.
>
>
> NSLocale has no idea about time zones - the two are orthogonal.  NSLocale does know what NSCalendar to use (so doing setLocale: should mean that you don't need to do setCalendar:), but a given locale can have more than one time zone, and a single time zone can potentially cross multiple locales.
>
> Not that that probably has a whole lot to do with NSDateFormatter returning empty strings...

The documentation says about dateStyles: "Do not use these constants if you want an exact format".

When I do: [ dateFormatter setDateStyle: NSDateFormatterFullStyle ]
it prints: "Tuesday 27 September 2011"
and when I add: 	[ dateFormatter setTimeStyle: NSDateFormatterFullStyle ]
it prints: "Tuesday 27 September 2011 23:18:16 Indochina Time"

Note that it was initialized with the dateFormat "EEE dd MMMM yyyy HH:mm:ss"

All rather confusing - but at least I get some output.


The reason for using dateFormatter was that I needed:

	NSArray *monthSymbols = [ dateFormatter monthSymbols ];
	NSArray *shortWeekdaySymbols = [ dateFormatter shortWeekdaySymbols ];

Is there a more direct way to get at these localized strings, without a dateFormatter?
Maybe NSUserDefaults?


Kind regards,

Gerriet.

_______________________________________________

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

References: 
 >NSDateFormatter refuses to format dates (From: "Gerriet M. Denkmann" <email@hidden>)
 >Re: NSDateFormatter refuses to format dates (From: Fritz Anderson <email@hidden>)
 >Re: NSDateFormatter refuses to format dates (From: "Gerriet M. Denkmann" <email@hidden>)
 >Re: NSDateFormatter refuses to format dates (From: glenn andreas <email@hidden>)

  • Prev by Date: Re: NSDateFormatter refuses to format dates
  • Next by Date: Re: Core Data : Undo Delete : Cannot fulfill a fault
  • Previous by thread: Re: NSDateFormatter refuses to format dates
  • Next by thread: Re: NSDateFormatter refuses to format dates
  • Index(es):
    • Date
    • Thread