• 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: NSCalendarDate not localized
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.


References: 
 >NSCalendarDate not localized (From: Bruno Blondeau <email@hidden>)

  • Prev by Date: Re: Background color for Drawers
  • Next by Date: RE: Yet more random number woes!
  • Previous by thread: NSCalendarDate not localized
  • Next by thread: _NSGetCarbonMenu question
  • Index(es):
    • Date
    • Thread