Return True When Time fall between a Time Range?
<p>I am making a function to check time fall between a time range in 24hr format, However there is some thing wrong with my code , can any one point out how to fix ?</p>

<p>My code:</p>

<pre><code>bool isDoTime(int starthour, int startminute, int endhour, int endminute)
    {
        TimeSpan start = new TimeSpan(starthour, startminute, 0); 
        TimeSpan end = new TimeSpan(endhour, endminute, 0);
        TimeSpan add24h = new TimeSpan(24, 0, 0);
        TimeSpan now = DateTime.Now.TimeOfDay;


        if (starthour &gt; endhour || (endhour == starthour &amp;&amp; endminute &lt;= startminute))
        {
            end += add24h;
        }
        if ((now &gt; start) &amp;&amp; (now &lt; end))
        {
            return true;
        }

        return false;
    }
</code></pre>

<p>Problem: i want to return true when current time between 20:30  - 3:30 , however when i run my code as below. the condition is return true only from 8:30 to 00:00 , not true from 00:00 - 3:30</p>

<pre><code>if (isDoTime(20,30,3,30) //return true from 20:30  - 3:30 
{
   //dosomething
}
</code></pre>
