title: How can I determine if iPhone is set for 12 hour or 24 hour time display?
body: <p>I thought I saw something answering this on SO recently but now I can't find it.  Here is the code I am using now to determine if settings are for 24 hour time display.  It works for me in the US, but I don't know if it will work in all locales.  Is this sufficient or is there a better way to find out the current setting for this?</p>
  
  <pre><code>+(BOOL) use24HourClock
  {
      BOOL using24HourClock = NO;
  
      NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];    
      [dateFormatter setLocale: [NSLocale currentLocale]];    
      [dateFormatter setDateStyle:kCFDateFormatterNoStyle];
      [dateFormatter setTimeStyle:kCFDateFormatterShortStyle];    
      // get date/time (1Jan2001 0000UTC)
      NSDate* midnight = [[NSDate alloc] initWithTimeIntervalSinceReferenceDate:0];   
      NSString* dateString = [dateFormatter stringFromDate: midnight];
      // dateString will either be "15:00" or "16:00" (depending on DST) or
      // it will be "4:00 PM" or "3:00 PM" (depending on DST)
      using24HourClock = ([dateString length] == 5);
      [midnight release];
      [dateFormatter release];    
  
      return using24HourClock;
  }
  </code></pre>