How to create a dropdown of time?
<p>I want to create a dropdown for time in PHP. It should be of 24 hour format with an interval of 30 minutes like <code>00:00</code> then <code>00:30</code> then <code>13:00</code> and so on.I want it round the clock.  </p>

<p>I have used this code</p>

<pre><code>&lt;?php 
    $start = strtotime('12:00 AM');
    $end   = strtotime('11:59 PM');
?&gt;
&lt;select style="width:85px;" name="select1" id="select1"&gt;
    &lt;?php for($i = $start;$i&lt;=$end;$i+=1800){ ?&gt;  
        &lt;option value='&lt;?php echo date('G:i', $i); ?&gt;'&gt;&lt;?php echo date('G:i', $i); ?&gt;&lt;/option&gt;;
    &lt;?php } ?&gt;
&lt;/select&gt;
</code></pre>

<p>The problem is that it doesn't cover the last span of 11:30 to 12:00 AM as the increment value exceeds the end, Is there a direct way to do this in PHP?</p>
