title: Returning true if the current time is between two military times?
body: <p>I have a function here that attempts to return true if the current time is between two military times. </p>
  
  <p>The issue here is finding a time between <code>2130</code> and <code>0700</code> is a little tricky. The <code>2130</code> works fine, but <code>0700</code> is before <code>2130</code>, so it returns false here. How can I get this to return true?</p>
  
  <p>Just switch the <code>&amp;&amp;</code> to a <code>||</code>?</p>
  
  <pre><code>public bool IsSleeping()
  {
      DateTime m_dt = DateTime.Now;
      string strMilitaryTime;
      int time;
  
      strMilitaryTime = m_dt.ToString("HHmm");    // Get current military time
      time = Convert.ToInt32(strMilitaryTime);    // Convert to int
  
      // The time must be between sleeping hours of 2400 and 0700.
      if (time &gt;= 2130 &amp;&amp; time &lt; 700)
          return true; 
  
      return false;
  }
  </code></pre>