kartik datetimepicker code example

Example 1: kartik datepicker

$form->field($model, 'attribute')->widget(\kartik\date\DatePicker::classname(), [
        'pluginOptions' => [
            'autoclose' => true,
            'format' => 'yyyy-mm-dd',
            'todayHighlight' => true
        ]
    ]);

Example 2: kartik datepicker

$form->field($model, 'attribute')->widget(DatePicker::classname(), [
    'options' => ['placeholder' => 'Enter birth date ...'],
    'pluginOptions' => [
        'autoclose'=>true,
        'todayHighlight' => true,
        'format' => 'yyyy/mm/dd',?,'yyyy-mm-dd',
    ]
]);

Tags:

Misc Example