title: How to compare two NSDate objects in objective C
body: <p>I have objects of Date type.</p>
  
  <p>I want to compare them, and I have written an if condition in the following  way:</p>
  
  <pre><code>if (([startDate1 isEqualToDate:[self getDefaultDate]]) || (startDate1 != [ self getDefaultDate] &amp;&amp; m_selectedDate &gt;= m_currentDate1 &amp;&amp; cycleStopped))
   {
  
  ///execute some condition
  
  }
  </code></pre>
  
  <p>Am I right or wrong in this approach?</p>
  
  <p>One more thing. Is this way right:</p>
  
  <pre><code>if (dtdate &gt; [m_array objectatIndex:i]
  {
  
  }
  </code></pre>
  
  <p>Because I am getting random behavior.</p>