Re: Thoroughly confused on date formatting
Re: Thoroughly confused on date formatting
- Subject: Re: Thoroughly confused on date formatting
- From: Deborah Goldsmith <email@hidden>
- Date: Fri, 29 Sep 2006 13:15:14 -0700
On Sep 29, 2006, at 10:36 AM, Matt Neuburg wrote:
Here is what I do:
NSDateFormatter *dateFormatter =
[[[NSDateFormatter alloc] init] autorelease];
[dateFormatter setFormatterBehavior:NSDateFormatterBehavior10_4];
[dateFormatter setDateStyle:NSDateFormatterShortStyle];
[dateFormatter setTimeStyle:NSDateFormatterShortStyle];
NSMutableString* f =
[NSMutableString stringWithString:[dateFormatter dateFormat]];
Aha, so now I have the user's preferences expressed as a mutable
string in
ICU format. So now I mutate the string to combine the user's
preferences
with my own (e.g. get rid of everything but hours and minutes, in your
case), and then:
[dateFormatter setDateFormat:f];
This can work, but not all the time. It isn't really possible to
determine which constant strings go with which fields. If you get rid
of the seconds, you also need to get rid of the string. Everyone is
familiar with this case:
hh:mm:ss
but how about this one?
hh時mm分ss秒
In the first case, you get rid of the colon between mm and ss. In the
second case, you get rid of the trailing character *after* ss.
This is a known problem, and is being worked on in ICU. See the
description of "availableFormats" in:
http://www.unicode.org/reports/tr35/#Calendar_Elements
Deborah Goldsmith
Internationalization, Unicode liaison
Apple Computer, Inc.
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