You can call [[NSLocale currentLocale] localeIdentifier], to get the
locale identifier of the user's preferred locale, and then create
another NSLocale from it. This will be a locale that doesn't have any
(not just formatting) user preference overrides in it but is still the
user's
Hi!
I am trying to format dates for display. So far I have been using this
formatter:
NSDateFormatter *dateFormatter = [[[NSDateFormatter alloc] init]
autorelease];
[dateFormatter setFormatterBehavior:NSDateFormatterBehavior10_4];
[dateFormatter
On 8/11/09 6:39 PM, Houdah - ML Pierre Bernard said:
I am trying to format dates for display. So far I have been using this
formatter:
NSDateFormatter *dateFormatter = [[[NSDateFormatter alloc] init]
autorelease];
[dateFormatter
Hi Sean,
I want to respect the user's locale, yet ignore his/her preferences as
to formatting.
I thought about modifying the format I get from the standard styles. I
would however expect NSLocale to know the correct order of elements in
the date format.
Pierre
So you want to use the
There are cases where that's totally appropriate. Maybe in a report it
requires a leading zero. You still want to respect the user's settings
in all other areas.
On Aug 11, 2009, at 11:48 AM, Sean McBride wrote:
On 8/11/09 6:39 PM, Houdah - ML Pierre Bernard said:
I am trying to format
Can you use separate formatters, one for the date, another for the
time, and just concatenate the resulting strings?
On Aug 11, 2009, at 09:51:59, Houdah - ML Pierre Bernard wrote:
Hi Sean,
I want to respect the user's locale, yet ignore his/her preferences
as to formatting.
I thought
Figured out one way to get the desired result. But really don't like
it. I'd much rather have NSLocal tell me if day or months value should
go first.
Anyway, here it goes:
NSDateFormatter *dateFormatter = [[[NSDateFormatter alloc] init]
autorelease];
[dateFormatter
Houdah - ML Pierre Bernard wrote:
NSMutableString *dateFormat = [NSMutableString stringWithString:
[dateFormatter dateFormat]];
[dateFormat replaceOccurrencesOfString:@d withString:@dd
options: 0 range:NSMakeRange(0, [dateFormat length])];
Unrestricted replacement of meta-characters