title: iOS : Date conversion results in wrong date
body: <p>I have done this several times before with several formats. Cannot understand what am overlooking here! Date conversion cannot be that hard! :) But seems like it's bothering too much.
  Am getting a string like this:
  <strong>Aug  9 2013 06:44:01:950AM</strong></p>
  
  <p>Am trying to convert it to date with this code:</p>
  
  <pre><code>[Date_Converter getDateFromString:date withFormat:@"MMM dd YYYY HH:mm:ss:SSSa"]
  </code></pre>
  
  <p>And in <strong>DateConverter.m</strong></p>
  
  <pre><code>+(NSDate *) getDateFromString:(NSString *) strDate
                     withFormat:(NSString *) format {
  
      NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
      [formatter setDateFormat:format];
      //[formatter setTimeZone:[NSTimeZone localTimeZone]];
      NSDate *dateFromStr = [formatter dateFromString:strDate];
      return dateFromStr;
  }
  </code></pre>
  
  <p>The <code>NSDate</code> return value am getting from the above method is this!
  <strong>2013-01-04 19:14:01 +0000</strong></p>
  
  <p>for the input date
  <strong>Aug  9 2013 06:44:01:950AM</strong></p>
  
  <p>How can this be? I have used the same method several times for various other formats of date. Please help. What am I overlooking here?</p>
  
  <p><strong>UPDATE</strong>
  Changed the format to </p>
  
  <pre><code>[Date_Converter getDateFromString : date
         withFormat : @"MMM dd yyyy hh:mm:ss:SSSa"];
  </code></pre>
  
  <p>but it still returns null. Kindly help.</p>
  
  <p><strong>WHAT HELPED FINALLY</strong>
  Adding
      [formatter setLocale:[[NSLocale alloc] initWithLocaleIdentifier:@"en_US_POSIX"]];
  to date conversion as @MartinR suggested below!</p>