title: NSPredicate to filter between two dates of NSString type
body: <p>I've some data (as <code>NSDictionary</code> in an <code>NSMutableArray</code>), a sample data is like,</p>
  
  <p><img src="https://i.stack.imgur.com/783Pp.png" alt="enter image description here"></p>
  
  <p>Consider each row as <code>NSDictionary</code> and entire table is an <code>NSMutableArray</code> contains events.</p>
  
  <p>I want to result between two dates, so I'm using <code>NSPredicate</code> to filter my data.</p>
  
  <hr>
  
  <p><strong>Here's my code snippet for this,</strong></p>
  
  <pre><code>NSPredicate *predicate = [NSPredicate predicateWithFormat:@"Date &gt;=  %@ AND
  Date &lt;=  %@", startDate,endDate];
  
  NSArray *filter = [arrayEvents filteredArrayUsingPredicate:predicate];
  </code></pre>
  
  <p><strong>Test filtration</strong>: </p>
  
  <hr>
  
  <p><strong>Case 1:</strong></p>
  
  <pre><code>NSString *startDate = @"01/07/14";
  NSString *endDate = @"31/07/2014";
  </code></pre>
  
  <p><strong>Output:</strong>
  All events (rows).</p>
  
  <hr>
  
  <p><strong>Case 2:</strong></p>
  
  <pre><code>NSString *startDate = @"20/07/14";
  NSString *endDate = @"31/07/2014";
  </code></pre>
  
  <p><strong>Output:</strong>
  Last four events (rows).</p>
  
  <hr>
  
  <p><strong>Case 3:</strong></p>
  
  <pre><code>NSString *startDate = @"11/07/14";
  NSString *endDate = @"20/07/2014";
  </code></pre>
  
  <p><strong>Output:</strong>
  Only 2nd event (row).</p>
  
  <hr>
  
  <p><strong>Case 4:</strong></p>
  
  <pre><code>NSString *startDate = @"01/08/14";
  NSString *endDate = @"31/08/2014";
  </code></pre>
  
  <p><strong>Output:</strong>
  All events (rows).</p>
  
  <hr>
  
  <p>Conclusion:</p>
  
  <blockquote>
    <p>Case 1, 2 and 3 is correct, where Case 4 is incorrect.</p>
  </blockquote>
  
  <hr>
  
  <p><strong>Notes:</strong></p>
  
  <ul>
  <li>Date is of type <code>NSString</code></li>
  <li>Date format is date-month-year (i.e. dd/MM/yyyy)</li>
  <li>Same result even  date is formatted with <code>- hyphen</code> instead of <code>/ (forward slash)</code></li>
  <li>Same result even if we changed date format month-date-year (i.e. MM/dd/yyyy)</li>
  </ul>
  
  <p>Some one please help me what I am doing wrong here? Anything that I'm missing? I know there's few other questions but none of which helped me.</p>