Check if hours is in time slot
<p>i have a question about something i do. I have an array with hours, and an array of array of appointments:</p>

<p>Array of hours looks like that:</p>

<pre><code>0 = 8h00
1 = 8h30
2 = 9h00
3 = 9h30
...
</code></pre>

<p>Array of appointments looks like that:</p>

<pre><code>0 = Start=8h00, End=8h45
1 = Start=9h00, End=10h00
...
</code></pre>

<p>The goal is to check if hours in the first array are between time slots in the second array. I'm creating another array of hours that are not between time slots.</p>

<p>I made a function checkTime(t1, t2, hours), where t1 is the start, t2 the end and hours is 8h00 (for example), then i check the next hour 8h30, then the next one 9h00...</p>

<p>When i checked all hours, i'm taking the second appointment (9h00, 10h00) and i'm checking again with 8h00, 8h30, 9h00...</p>

<p>It works fine, but i'm pretty sure, there is an elegant way to make this. Can you please tell me what you think?
Thanks!</p>