• 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: 24-hour default
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 24-hour default


  • Subject: Re: 24-hour default
  • From: Chuck Soper <email@hidden>
  • Date: Sun, 23 Oct 2005 10:10:30 -0700

Thanks for your response. Here is the code I use to detect 24-hour default.

NSDictionary *localeDict = [[NSUserDefaults standardUserDefaults]
                            dictionaryRepresentation];
BOOL euroFormat = FALSE;
NSString *defaultTimeFormat = [localeDict objectForKey:NSTimeFormatString];
if (defaultTimeFormat != nil) {
    NSRange range = [defaultTimeFormat rangeOfString:@"I"];
    euroFormat = range.location == NSNotFound && range.length == 0;
}

Chuck


At 11:14 AM -0400 10/20/05, The Karl Adam wrote:
yes, and NSCalendarDate returns the current user's setting for the
formatting in that locale. But if you must do it yourself, the key
your looking for is NSTimeFormatString in the user locale settings in
the user defaults domain. It doesn't tell you whether they have AM/PM
or 24hour time, but instead gives you their time format string which
should take into account 24hr time preferences.

The rest of the local settings are in User defaults:
http://developer.apple.com/documentation/Cocoa/Reference/Foundation/ObjC_classic/Classes/NSUserDefaults.html#//apple_ref/doc/c_ref/NSAMPMDesignation

On 10/19/05, Raffael Cavallaro <email@hidden> wrote:

On Oct 19, 2005, at 3:08 AM, Chuck Soper wrote:

 > I believe that I need to determine if the current locale uses a 24-
 > hour time format or not.

 Actually, you need to determine what the individual user's
 preferences for 12/24 hour clock are since the user can set this
 option in the Date and Time System Preferences panel regardless of
 what the default is for the locale.

 regards,

 Ralph

Raffael Cavallaro, Ph.D.
> email@hidden

_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Re: 24-hour default (From: Raffael Cavallaro <email@hidden>)
 >Re: 24-hour default (From: The Karl Adam <email@hidden>)

  • Prev by Date: Re: FSRefMakePath: error -35
  • Next by Date: Re: 24-hour default
  • Previous by thread: Re: 24-hour default
  • Next by thread: Re: 24-hour default
  • Index(es):
    • Date
    • Thread