title: c# Compare datetime with 2 other dates
body: <p>Im trying to compare a specific date <code>periodDate</code> which is stored in a xml file with one <code>stopDate</code> and <code>startDate</code>.</p>
  
  <p>So if <code>periodDate</code> is between <code>startDate</code> and <code>StopDate</code> insert data:</p>
  
  <pre><code>if ((DateTime.Compare(periodTime, startDatePer1) == 1) 
     &amp;&amp; (periodTime.CompareTo(stopDatePer1) == 1)) 
  {
     // ... insert some data to databse                 
  }
  else if ((DateTime.Compare(periodTime, startDatePer2) == 1)
          &amp;&amp; (periodTime.CompareTo(stopDatePer2) == 1))
  {
     // ..... insert data 
  }
  </code></pre>
  
  <p>My problem is that im stuck on the first <code>if</code> even if the <code>periodDate</code> is NOT between <code>startDate</code> and <code>stopDate</code>.</p>