Цю сторінку ще не перекладено українською, тому нижче англійська версія.

date_box2(), time_box2(), datetime_box2() html()

Date, time and date-time selects posting name[year], name[month]... (what form()->date_box() renders).

html()->date_box2($name, $selected = '', $years = '', $add_str = '', $show_what = 'ymd', $show_text = 1, $translate = 1)
html()->time_box2($name, $selected = '', $add_str = '', $show_text = 1, $translate = 1)
html()->datetime_box2($name, $selected = '', $years = '', $add_str = '', $show_what = 'ymd', $show_text = 1, $translate = 1)

Опції

ОпціяЗначення
$name, $selectedName; value Y-m-d, H:i:s or Y-m-d H:i:s.
$years, $add_str, $show_what, $show_text, $translateAs for date_box().

Приклад



Код

return html()->date_box2('start', '2026-11-15') . '<br>' . html()->time_box2('opens', '09:30:00') . '<br>' . html()->datetime_box2('ends', '2026-11-30 18:00:00');

Примітки

  • The parts post as an array: $_POST['opens'] is ['hour' => ..., 'minute' => ..., 'second' => ...] (datetime_box2(): year ... second). Pass that array back as $selected to show the posted value again.
  • Fixed 2026-11-15: before, time_box2() wrote name="opens"[hour] (bracket outside the quotes), so its three selects all posted opens and only the seconds arrived.
  • datetime_box2() gives the date selects the Y-m-d part of its value and the time selects the H:i:s part (a timestamp or a posted array goes to both); h, i, s in $show_what are ignored. Fixed 2026-11-15: before, the day and the hour of a Y-m-d H:i:s value were never selected and ymdhis printed his as text.

Див. також: form/date_box, html/date_box