title: How can I compare "today" (NSDate) to a formatted string date (dd/MM/yyyy)?
body: <p>I'm new to iOS programming and I've been looking a lot for a way to compare "today" (an NSDate) to a formatted string date (dd/MM/yyyy).</p>
  
  <p>I've found some good answers with the NSDate's <code>earlierDate</code>, <code>laterDate</code> etc. but the code doesn't seem to work in my project.</p>
  
  <p>here it is : </p>
  
  <pre><code>// [book quandd]  is the string :    25/02/2011  (or whatever dd/MM/yyyy date)
  
  NSDate *today = [NSDate date];
  NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
  [dateFormat setDateFormat:@"dd/MM/yyyy"];
  
  if ( [[dateFormat dateFromString:[book quandd]] isEqualToDate:today]) {
      NSLog(@"Dates are equal");
  }
  if ( [[dateFormat dateFromString:[book quandd]] earlierDate:today]) {
      NSLog(@"earlier");
  }
  if ( [[dateFormat dateFromString:[book quandd]] laterDate:today]) {
      NSLog(@"later");
  }
  </code></pre>
  
  <p>Whatever I do and whatever the date in <code>[book quandd]</code>, the console always writes "earlier" and "later", as if they were later and earlier at the same time than <em>today</em>.</p>
  
  <p>Where is that "bug" coming from ?</p>
  
  <p>Is there some easy/easier way to compare the <em>today</em> date with <em>26/02/2011</em> for example ?</p>