Re: NSDateFormatter formats from NSLocale

2009-08-12 Thread Christopher Kane
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

NSDateFormatter formats from NSLocale

2009-08-11 Thread Houdah - ML Pierre Bernard
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

Re: NSDateFormatter formats from NSLocale

2009-08-11 Thread Sean McBride
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

Re: NSDateFormatter formats from NSLocale

2009-08-11 Thread Houdah - ML Pierre Bernard
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

Re: NSDateFormatter formats from NSLocale

2009-08-11 Thread Alex Kac
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

Re: NSDateFormatter formats from NSLocale

2009-08-11 Thread Rick Mann
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

Re: NSDateFormatter formats from NSLocale

2009-08-11 Thread Houdah - ML Pierre Bernard
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

Re: NSDateFormatter formats from NSLocale

2009-08-11 Thread Greg Guerin
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