title: How to set date format to 24 hour in Objective-c?
body: <p>I am having problem displaying proper date in my app. When user sets 24 hour format 'ON' in his date time preferences..my app shows correct time but when 24 hour format is set to 'OFF' it shows nothing.</p>
  
  <p>Here is the code I am using: </p>
  
  <pre><code>NSDateFormatter *formatter       =   [[NSDateFormatter alloc] init];
  
  [formatter setDateStyle:style];
  
  [formatter setDateFormat:@"YYYY-MM-dd HH:mm:ss"];
   NSDate *temp            =   [formatter dateFromString:strDate];
  
  [formatter setDateFormat:format];
  [formatter setLocale:[NSLocale currentLocale]];
  
  NSString *returnStr     =   [formatter stringFromDate: temp];
  [formatter release];
  NSLog(@"Return: %@", returnStr);
  
  return returnStr;
  </code></pre>