Get the time slots between the start time and end time
<p>I have <strong>start time</strong>, <strong>end time</strong>, and <strong>interval</strong>. </p>

<p><strong>I have to get the time slots between the start time and end time.</strong></p>

<p>I have</p>

<pre><code>var starttime = "09:50:00";
var endtime = "10:50:00";
var interval = "10";
</code></pre>

<p>And I want the <code>time slots</code> as array</p>

<pre><code>var timeslots = ["09:50:00","10:00:00","10:10:00","10:20:00","10:30:00","10:40:00","10:50:00"];
</code></pre>

<p>The <code>starttime</code>, <code>endtime</code> and <code>interval</code> may vary. How to get the timeslots as desired?</p>

<p><strong>To add interval to the time</strong> I have:</p>

<pre><code> function addMinutes(time, minsToAdd) {
  function D(J){ return (J&lt;10? '0':'') + J;};
  var piece = time.split(':');
  var mins = piece[0]*60 + +piece[1] + +minsToAdd;

  return D(mins%(24*60)/60 | 0) + ':' + D(mins%60);  
}  //this is working
</code></pre>

<p>I tried below to generate the <code>time slot</code> array.</p>

<pre><code>var starttime = "09:50:00";
var interval = "10";
var endtime = "10:50:00";
var timeslots =[stime];


while(starttime ==endtime ){

starttime = addMinutes(starttime , interval); 
timeslots.push(stime);

}
alert(timeslots.length);
</code></pre>

<p>But the array length shows <code>1</code>, means not working...</p>

<p>Please help me to rectify this.. OR help me with any alternative way...</p>