title: Get the number of hours between time Period
body: <p>I have run in a scenario where i need to find the total number of hours that falls on a current period. I Have a Time in and TimeOut datetime which i want to get the hours where the employee worked between 10pm-4am the following day. How would i get the output of hours worked. </p>
  
  <p>I Created an Extension method like this:</p>
  
  <pre><code> public static decimal GetNightDifferentialValue(this DailyTime dtr, Employee201 employee, PayrollSettings settings, IEnumerable&lt;Holidays&gt; holidays)
      {
          //know if the time out is greater than 10pm of the dtr
          //07-26-2016 14:00 - 07-27-2016 03:00
          //if time out i
          var days = Enumerable.Range(0, (int)(dtr.TimeOut - dtr.TimeIn).TotalHours + 1)
              .Select(i =&gt; dtr.TimeIn.AddHours(i))
              .Where(date =&gt; !(date.Hour &gt;= 22)).Count();
          return days* employee.Rate;
  
      }
  </code></pre>
  
  <p>my problem is in the Where Method how can i Filter the hours that only fall on my category</p>