title: Trying to change the date format on iOS
body: <p>I parse a date from an xml file and store it in a string variable like this :</p>
  
  <pre><code>NSString *dateTex = [[stories objectAtIndex: storyIndex] objectForKey: @"date"];
  </code></pre>
  
  <p>When i try to print this variable on console i get :</p>
  
  <p>the object value is:Fri, 01 Jun 2012 15:52:00 GMT</p>
  
  <p>I am trying to change the format of the above date , to be stored again in a string variable but like this : dd/mm/yy.
  I tried this code : </p>
  
  <pre><code>//changing dates format
  NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; 
  [dateFormatter setDateFormat:@"EEE, d MMM YYYY HH:mm:ss Z"];
  
  NSDate *date = [dateFormatter dateFromString:dateTex];
  [dateFormatter release];
  
  NSDateFormatter *dateFormatter2 = [[NSDateFormatter alloc] init];
  [dateFormatter2 setDateFormat:@"dd/mm/yyyy"];
  NSString *dateText = [dateFormatter2 stringFromDate:date];
  [dateFormatter2 release];
  NSLog(@"the object value is:%@",dateText);
  </code></pre>
  
  <p>But when i print the dateText variable on console i get :</p>
  
  <p>the object value is:(null)</p>
  
  <p>What am i doing wrong and the date is never stored in the variable?
  Thanks!</p>