• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Determining user's clock preference on iOS
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Determining user's clock preference on iOS (From: Rick Mann <email@hidden>)

  • Prev by Date: Semi-Transient NSPopover disappearing when it shouldn't (10.7.3)
  • Next by Date: Re: NSView mouseDown truncated coordinates
  • Previous by thread: Re: Determining user's clock preference on iOS
  • Next by thread: Re: Determining user's clock preference on iOS
  • Index(es):
    • Date
    • Thread