title: Convert String to Date in Objective-C
body: <p>How do i convert string to date in Objective C.</p>
  
  <p>I have tried the following but did not figure it out.</p>
  
  <pre><code>NSString *str = @"3/2/2018 11:44:32 AM";
  
  NSDateFormatter *df = [[NSDateFormatter alloc] init];
  
  [df setDateFormat:@"MM/d/yyyy h:mm:ss a"];
  
  NSDate *resultDate = [[NSDate alloc] init];
  
  resultDate = [df dateFromString:str];
  
  NSLog(@"result date: %@", resultDate);
  
  result date: 2018-03-02 06:14:32 +0000 ,but i need to get it as 
  result date: 3/2/2018 11:44:32 AM
  </code></pre>