• 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
Internationalized Dates
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Internationalized Dates


  • Subject: Internationalized Dates
  • From: Seth Willits <email@hidden>
  • Date: Tue, 31 Oct 2006 19:55:00 -0800

Hi,



I'm trying to have a date drawn in a format to fit the width of a column in a table view. Drawing and determining which to use is obviously easy, the question is, where the heck do you get the formats from?

This works wonderfully for us American folk:

@"%A, %B %e, %Y, %I:%S %p";
@"%B %e, %Y, %I:%S %p";
@"%b %e, %Y, %I:%S %p";
@"%m/%d/%y, %I:%S %p";
@"%m/%d/%y";

But it sucks for internationals, obviously.


This I thought might be a decent approach:

[standardUserDefaults objectForKey:NSTimeDateFormatString];
[standardUserDefaults objectForKey:NSDateFormatString];
[standardUserDefaults objectForKey:NSShortTimeDateFormatString]
[standardUserDefaults objectForKey:NSShortDateFormatString];

But it's not much better. Who needs the time zone for something they modified (NSTimeDateFormatString)? And there's no intermediary between NSDateFormatString and NSShortXXXFormatString (iow, with abbreviated months or days of the week etc).

So I'd much prefer to use the literals, but how would I handle internationalizing them? I would localize the constant, but there are no other localizations at the moment. I suppose I could just check the locale and switch between the literals and the format from user defaults.

What do you guys do?



--
Seth Willits



_______________________________________________
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


  • Follow-Ups:
    • Re: Internationalized Dates
      • From: Nick Zitzmann <email@hidden>
  • Prev by Date: NSTokenField Drag and Drop not updating value immediately via bindings?
  • Next by Date: Re: Internationalized Dates
  • Previous by thread: NSTokenField Drag and Drop not updating value immediately via bindings?
  • Next by thread: Re: Internationalized Dates
  • Index(es):
    • Date
    • Thread