Re: Determining user's clock preference on iOS
Re: Determining user's clock preference on iOS
- Subject: Re: Determining user's clock preference on iOS
- From: Nick Zitzmann <email@hidden>
- Date: Thu, 23 Feb 2012 10:34:53 -0700
On Feb 22, 2012, at 11:50 PM, Rick Mann wrote:
> If I could determine the user's preference, then I'd just format it appropriately. Alternatively, I can use the "short" format style, and then parse out the AM/PM, but that seems more fragile across locales (are there locales that use something other than "am" and "pm"?).
>
> Any suggestions?
That is the only way to do it - look at the short format string returned by an NSDateFormatter and see if there is an "a" in it that does not appear inside quotes. The "am" and "pm" strings are localized for the user by the date formatter when turning a date into a string, so it's okay to just parse the format string returned by the date formatter (but not the results of feeding a date into it).
Nick Zitzmann
<http://www.chronosnet.com/>
_______________________________________________
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