title: Using PHP Carbon, remove time in seconds where two time periods overlap
body: <p>An outage may range from a couple of minutes extending to multiple days.  I store this in an outages table that has start date/time and end date/time.  On saving an outage record, the duration in seconds is calculated using Carbon.</p>
  
  <pre><code>$outage-&gt;duration = $outage-&gt;start_time-&gt;diffInSeconds($outage-&gt;end_time, true);
  </code></pre>
  
  <p>I now need to remove any time that is between 5pm and 7:59:59 am (i.e. outside of business hours) but I have no idea where to start and appreciate any help :)</p>