Yii 2 datetime picker demo
1 download kartik from git or composer (https://github.com/kartik-v/yii2-widget-datetimepicker)
$ php composer.phar require kartik-v/yii2-widget-datetimepicker "*"
2. view code
use kartik\datetime\DateTimePicker;
<?= $form->field($model, 'u_expiredDate')->widget(DateTimePicker::className(), [
'pluginOptions' => [
'format' => 'yyyy-mm-dd hh:ii:ss',
'autoclose' => true,
]
]) ?>
<?=
DateTimePicker::widget([
'model' => $model,
'attribute' => 'aspl_actionDate',
'options' => ['placeholder' => 'Please Select a Date'],
'pluginOptions' => [
'format' => 'yyyy-mm-dd hh:ii:ss',
]
]);
?>
<?=
DateTimePicker::widget([
'name' => 'yiilib_datetime',
'options' => ['placeholder' => 'Select operating time ...'],
'convertFormat' => true,
'pluginOptions' => [
'format' => 'yyyy-mm-dd hh:ii:ss',
'startDate' => '2019-01-01 12:12:12',
'todayHighlight' => true
]
]);
?>
Leave Comment