title: ios: String to Date conversion
body: <p>I am trying to convert my date from NSString to NSDate using following code</p>
  
  <pre><code>NSDateFormatter *dateformatter = [[NSDateFormatter alloc]init];
  [dateformatter setDateStyle:NSDateFormatterShortStyle];
  [dateformatter setTimeStyle:NSDateFormatterNoStyle];
  [dateformatter setDateFormat:@"dd/MM/yyyy"];
  NSDate *myDate = [[NSDate alloc] init];
  
  currMonth = 3;
  currYear = 2012;
  NSString *str = [NSString stringWithFormat:@"01/%2d/%d", currMonth, currYear];
  str = [str stringByReplacingOccurrencesOfString:@" " withString:@"0"];
  myDate = [dateformatter dateFromString:str];
  NSLog(@"myStr: %@",str);
  NSLog(@"myMonth: %2d",currMonth);
  NSLog(@"myYear: %d",currYear);
  NSLog(@"myDate: %@",myDate);
  </code></pre>
  
  <p>Above code is giving me wrong date. Can anyone please help?</p>