• 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: 12 hr vs 24 hr time display
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 12 hr vs 24 hr time display


  • Subject: Re: 12 hr vs 24 hr time display
  • From: Quincey Morris <email@hidden>
  • Date: Tue, 03 Jan 2017 01:35:17 -0800
  • Feedback-id: 167118m:167118agrif8a:167118sDBluJVIQ0:SMTPCORP

On Jan 2, 2017, at 22:16 , Sandor Szatmari <email@hidden> wrote:
>
> There are supported methods using: (works with method 2)
>    NSString *format = [NSDateFormatter dateFormatFromTemplate:@"j" options:0 locale:[NSLocale currentLocale]];
>    BOOL is24Hour = ([format rangeOfString:@"a"].location == NSNotFound);

Well of course this won’t work in every locale, not even all the English-speaking ones, since (IIRC) it’s “AM” in some of them, but I assume you’ve breezed right past that small point. :)

It seems to me you have two choices. One is to honor the setting for time *text* and to use the date formatter result unmodified (which means you might get more characters than just the 3 or 4 or 5 that represent the time with a possible separator). Or, if your app really is more like a clock, then I’d make the 12/24 hr format a setting within the app. As you’ve seen from the menu bar clock, there does seem to be a possible distinction between clock time format and annotation time. Since you can’t access the menu bar format (no public API at least), a one-time app setting seems reasonable.

_______________________________________________

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


  • Follow-Ups:
    • Re: 12 hr vs 24 hr time display
      • From: Sandor Szatmari <email@hidden>
References: 
 >12 hr vs 24 hr time display (From: Sandor Szatmari <email@hidden>)

  • Prev by Date: 12 hr vs 24 hr time display
  • Next by Date: Re: UIModalPresentationFormSheet on iPad and iPhone
  • Previous by thread: 12 hr vs 24 hr time display
  • Next by thread: Re: 12 hr vs 24 hr time display
  • Index(es):
    • Date
    • Thread