I have two variables:
$end_time. These values are times in 24 hour
XX:XX format, and always end with either
:30. They are supposed to define a range that determines times that appear in a drop-down select list in a HTML form, but the form displays the format in
X:XX am/pm notation.
For example, if I have these values:
$start_time = "11:00"; $end_time = "13:30";
What PHP code do I use to generate a select list which looks like this?
<option value="11:00">11:00 am</option> <option value="11:30">11:30 am</option> <option value="12:00">12:00 pm</option> <option value="12:30">12:30 pm</option> <option value="13:00">1:00 pm</option> <option value="13:30">1:30 pm</option>
I know how to accomplish this by building an array of all possible values manually and then working backwards, but there must be a much more elegant way that uses PHP's built-in time functions.
Any guidance would be much appreciated.