I have the time combobox with 30 minutes increment but I am unable to add am/pm in that.
This is the current time format showing (12:00, 12:30, 01:00, 01:30)
.
I want to display time like (12:00pm, 12:30pm, 01:00am, 01:30am)
.
My code is below:
for($hours=0; $hours<24; $hours++) // the interval for hours is '1'
for($mins=0; $mins<60; $mins+=15) // the interval for mins is '30'
echo '<option value="'.str_pad($hours,2,'0',STR_PAD_LEFT).':'.str_pad($mins,2,'0',STR_PAD_LEFT).'">'.str_pad($hours,2,'0',STR_PAD_LEFT).':'.str_pad($mins,2,'0',STR_PAD_LEFT).'</option>';