date_box(), time_box() html()

Day, month and year selects (date_box()) or hour, minute, second selects (time_box()) named date_* / time_*.

html()->date_box($selected = '', $years = '', $name_postfix = '', $add_str = '', $show_what = 'ymd', $show_text = 1, $translate = 1)
html()->time_box($selected = '', $name_postfix = '', $add_str = '', $show_text = 1, $translate = 1)

Options

OptionMeaning
$selectedValue Y-m-d / H:i:s.
$years, $name_postfix, $add_strYear range 2000-2030; suffix of the names; extra attributes.
$show_what, $show_text, $translateParts (ymd); empty first options; translated month names.

Example


Code

return html()->date_box('2026-11-15', '2020-2030') . '<br>' . html()->time_box('09:30:00');

Notes

  • They post fixed names (year, month, day... with the postfix); date_box2() takes a name.

See also: html/date_box2, form/date_box