NSDateFormatter question
NSDateFormatter question
- Subject: NSDateFormatter question
- From: Chuck Soper <email@hidden>
- Date: Thu, 3 Jul 2008 13:13:52 -0700
Hello,
Currently, I'm creating a NSDateFormatter instance as follows:
dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateStyle:kCFDateFormatterMediumStyle];
[dateFormatter setTimeZone:myTimeZone];
Assuming that the user hasn't modified their International formats
using System Preferences (a fairly big assumption), then the
following regions will use these formats (using [dateFormatter
dateFormat]):
United States: MMM d, yyyy
Belgium: dd MMM yyyy
Japan: yyyy/MM/dd
Is there a way that I can add a day of week abbreviation and have to
displayed correctly for all locales? For example, I'd like "Thu, Jul
3, 2008" for the United States and to have the day of week
abbreviation added to the proper location (in the string) for other
locales.
I'm fairly sure that what I'm trying to do is not possible or
practical. I think that my only option is to specify a hard coded
format string using setDateFormat: by referring to the following Date
Format Patterns:
http://unicode.org/reports/tr35/tr35-4.html#Date_Format_Patterns
Of course, this approach would not be multi-locale compatible so I
should avoid it.
In summary, if I want to have multi-locale compatible date formats, I
should not attempt to add a day of week abbreviation. Instead, I
should rely on kCFDateFormatterMediumStyle. Does this sound like the
best approach?
Thanks,
Chuck
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden