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 (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to