i need dynamic time select box 5 minutes interval in php. me?
<select name="time" id="time"> <option value="5:00 am">5:00 am</option> <option value="5:05 am">5:05 am</option> <option value="5:10 am">5:10 am</option> . . . . <option value="23:55 am">23:55 am</option> </select>
with datetime
:
$datetime = new datetime('5:00 am'); for($i=0; $i <= 515; $i++) { echo $datetime->format('h:i a'), "\n"; // add 5 minutes $datetime->modify('+5 minutes'); }
you can use modify
add how many minutes want.
Comments
Post a Comment