I have searched through these issues and not seen an answer.

I want to make a sensible (for my users) hour range dropdown in my form using date_select with the Date API. My users will never be entering 23:00 so why have the dropdown with that in the selections?

I see a year range, and a way to limit the minutes by date_increment, but no hour range.

How would I display just 08:00 to 20:00 (for example) in the drop downs? I don't want to us am/pm.
Code I am using

$format = "G:i";
$form['site_characteristics']['sampling_time'] = array(
	'#type' => 'date_select',
	'#date_format' => $format,
	'#date_label_position' => 'within',
	'#date_increment'	 => 15,
	'#title' => t('Please enter the approximate time'),
);

Thanks

Comments

arlinsandbulte’s picture

Status: Active » Closed (won't fix)

Hi,
I am just indiscriminately closing all support requests with no activity for more than 1 year.
If you consider this to still be a valid issue / support request, feel free to re-open.
BUT,
if you are re-opening this issue, please provide specific details on how this issue can move forward.

Thanks.