Localized dates and times
Localized dates and times
- Subject: Localized dates and times
- From: Marc Laffitte <email@hidden>
- Date: Mon, 12 Nov 2001 19:55:53 +0100
I lost enough time searching for an answer, so let me ask you:
What I want to do should be relatively easy:
I just want to display an NSDate (or NSCalendarDate) in a text field
according to the user Date and Time settings in the International pane
of the system preferences.
So, even if the main system language is set to English, if I use French
for date and time, I would like something like: lundi 12 novembre 2001,
19h43
What I get for now is "lundi, novembre 12, 2001 18:00:53" if I do
somethiing like:
NSString * tDateString = [NSDate
dateWithTimeIntervalSince1970:myDateSince1970];
If instead of an NSDate I use an NSCalendarDate, I can set the format to
what I want but I don't know how to get the currents settings. (I could
read directly the pref file
/Users/<currentUser>/Library/Preferences/com.apple.HIToolbox.plist, but
I don't think this would be very clean).
However, with such a format, I get the day and months in english, not
french as set in my system preferneces...
If I connect my text field with an NSDateFormatter in my nib file, days
and months are displayed in the right language. But the format is fixed
to whatever is defined in the nib file. Even if I can choose an other
NSDateFormater, I still don't know how to get the current user settings.
I suppose I am missing something probably trivial, but...
I would appreciate any help.
Marc
PS: My system clock has also some difficulties in displaying dates the
correct way: It shows "lundi 11/12/2001 7:51" instead of "lundi
12/11/2001 19:51" according to my settings...