la syntaxe à utiliser pour obtenir un champ date + heure :
<?php
e($form->label('startdate', 'start Date'))."\n";
echo $form->dateTime('startdate','DMY',24 ,$startdate.' 10:30',array(
'maxYear'=> date('Y') + 5,
'minYear'=> '2008',
'type' => 'time',
'interval' => 15),
false);
?>
La règle de validation à utiliser car rule=>date ne prend pas en compte l'heure
<?php
'startdate' => array(
'rule' => '/^[12][0-9]{3}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01]) ([01][0-9]|[2][0-4]):([0-5][0-9]|[0-9]):([0-5][0-9]|[0-9])$/',
'message' => 'format de date non valide'
),
?>
encore un peu de code pour utiliser un date picker
trouvé sur le bakery date-picker-widget, avec une solution simple au commentaire 18.
<?php
//Create label for Date field named 'Date'
e($form->label('startdate', 'Date début'))."\n";
//Create combo box for 'day'
e($form->day('startdate', null, array('id' => 'StDate-dd'), false)." - ")."\n";
//Create combo box for 'month'
e($form->month('startdate', null, array('id' => 'StDate-mm'), false)." - ")."\n";
//Create combo box for 'year' and call date picker's class.
//See in the class called got 'split-date'.
//Use this for splitting the day, month & year field.
e($form->year('startdate', '2008', date('Y') + 5, null, array('id' => 'StDate', 'class' => 'show-weeks highlight-days-67 split-date opacity-90'), false))."\n";
?>
