title: Print Time Slot In JavaScript
body: <p>The problem is that when I'm taking the current time using <code>localdate</code>(this is my start time) variable and I'm also taking end time so I print the time between this values with 15 min of increasing time.</p>
  
  <p>Example: current time is 13:04 so the further time slots will be 13:19, 13:34 and so on till end time.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function ShowLocalDate() {
    var time1 = new Date();
    var time2 = new Date();
    var dNow = new Date();
    var localdate = dNow.getHours() + ':' + dNow.getMinutes();
  
    //meeting length
    var meetingLength = parseInt('15');
  
    //start time 
    var startTime = localdate
    var startHour = startTime.split(':')[0];
    var startMin = startTime.split(':')[1].replace(/AM|PM/gi, '');
  
    //end time
    var endTime = '11:00 PM';
    var endHour = endTime.split(':')[0];
    var endMin = endTime.split(':')[1].replace(/AM|PM/gi, '');
  
    //Check if start time is PM and adjust hours to military
    if (startTime.indexOf('PM') &gt; -1) {
      if (startHour != 12) {
        startHour = parseInt(startHour) + 12;
      } else {
        startHour = parseInt(startHour);
      }
      console.log(startHour);
    }
  
    //Check if end time is PM and adjust hours to military
    if (endTime.indexOf('PM') &gt; -1) {
      endHour = parseInt(endHour) + 12;
      console.log(endHour);
    }
  
    //Date API start time
    time1.setHours(parseInt(startHour));
    time1.setMinutes(parseInt(startMin));
  
    //Date API end time
    time2.setHours(parseInt(endHour));
    time2.setMinutes(parseInt(endMin));
  
    //Adding meeting length to start time, this value will be use for end    time
    time1.setMinutes(time1.getMinutes() + meetingLength);
  
    while (time1 &lt; time2) {
      $('#etime').append('&lt;option value="' + time1 + '"&gt;' + time1 + '&lt;/option&gt;');
      time1.setMinutes(time1.getMinutes() + meetingLength);
    }
  }
  ShowLocalDate();</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;tr&gt;
    &lt;td&gt;
      &lt;select name="etime" id="etime"&gt;
        &lt;option value=""&gt;--Select end time--&lt;/option&gt;
      &lt;/select&gt;
    &lt;/td&gt;
  &lt;/tr&gt;
  &lt;/tr&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>JSFiddle: <a href="https://jsfiddle.net/6n458ze9/18/" rel="nofollow noreferrer">https://jsfiddle.net/6n458ze9/18/</a></p>
  
  <p>But I want that, suppose the start time means current time is 13:04 so the next time will be 13:20 not 13:19 and one more time is 13:35 not 13:34, till ending time.</p>
  
  <p>End time will be 11:00 PM(this is fixed).</p>
  
  <p>Thank you in advance. </p>