Re: NSCalendarDate not localized
Re: NSCalendarDate not localized
- Subject: Re: NSCalendarDate not localized
- From: Jeremy Dronfield <email@hidden>
- Date: Mon, 14 Jun 2004 10:16:44 +0100
To get a localized description of an NSCalendarDate based on the user's
System Preferences settings, you can use
-descriptionWithCalendarFormat:locale:, like so:
NSString *aDateString = [myCalendarDate
descriptionWithCalendarFormat:[[NSUserDefaults standardUserDefaults]
objectForKey:NSDateFormatString] locale:[[NSUserDefaults
standardUserDefaults] dictionaryRepresentation]];
Hope this helps. Regards,
-Jeremy
===================================
SkoobySoft, home of viJournal
email: email@hidden or visit:
http://freespace.virgin.net/jeremy.dronfield/skoobysoft.html
===================================
On 13 Jun 2004, at 11:35 pm, Bruno Blondeau wrote:
I'm using the following code to insert the current date:
NSString * my_format = [[NSUserDefaults standardUserDefaults]
objectForKey:NSDateFormatString];
[textView insertText:[[NSCalendarDate calendarDate]
descriptionWithCalendarFormat:my_format]];
However, in all cases, I'm getting this
Monday 14 June 2004
Even if the system preferences are set for a different date format.
How can I modify this code to be localized?
Bruno
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.