Re: Getting the NSDateFormatter strings from the user's preferences
Re: Getting the NSDateFormatter strings from the user's preferences
- Subject: Re: Getting the NSDateFormatter strings from the user's preferences
- From: James Bucanek <email@hidden>
- Date: Fri, 20 May 2005 11:01:56 -0700
Sean McBride wrote on Friday, May 20, 2005:
>On 5/19/05 6:08 PM, James Bucanek said:
>
>>>So for example NSShortDateFormatString and NSDateFormatString aren't what
>>>you want? Could you elaborate on what your looking for?
>>
>>As I said, I was looking for a format string, or a formatter, that would
>>format dates according to the user customizable date and time setting the
>>International Preference Pane.
>
>That's what NSShortDateFormatString and NSDateFormatString do.
It turns out you are half (1/4?) correct.
After some experimentation, I have found that NSShortDateFormatString corresponds to the Short date defined by the user in the International Prefeence Pane. However, NSDateFormatString (which I was more interested in) does not correspond to any of the formats defined by the user.
As an experiment, I edited my date formats in System Preferences to all be "military" style dates (01-May-2005). I then restarted my computer (to avoid any caching) and ran my application again.
The value returned for NSShortDateFormatString changed from '%1m/%e/%y' to '%e-%m-%y' as per my preference. But the value for NSDateFormatString still returns '%A, %B %e, %Y %1I:%M:%S %p %Z', which doesn't match anything the I defined.
Since I was far more interested in the Full, Long, and Medium date formats defined by the user, the values in NSUserDefaults are still useless for my application.
>>It turns out that the date and time format strings in the NSUserDefaults
>>are NOT these values. You can customize your date and time formatting
>>preferences all day, and the strings in NSUserDefaults never change (and,
>>they're not even very pretty to begin with).
>
>Works for me. You can even try it in my app if you want (www.birthday-
>buzzer.com), works with Hebrew, Japanese, etc.
I have no doubts that the other date formats are localized, but that doesn't mean they correspond to the user's preferences in the International preferences pane.
>But your CFDateFormatter is certainly better. It works in 10.3, yes?
Yes.
--
James Bucanek <mailto:email@hidden>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden