Home>Article>PHP Framework> Use of datepicker date component in yii
1. Installation of date component
composer require kartik-v/yii2-widget-datepicker "@dev"
2. Use of date component
use kartik\date\DatePicker; 'Article[created_at]', 'options' => ['placeholder' => '...'], //value值更新的时候需要加上 'value' => '2016-05-03', 'pluginOptions' => [ 'autoclose' => true, 'format' => 'yyyy-mm-dd', 'todayHighlight' => true, ] ]); ?>
The usage of date component generated by ActiveForm is as follows :
= $form->field($model, 'created_at')->widget(DatePicker::classname(), [ 'options' => ['placeholder' => ''], 'pluginOptions' => [ 'autoclose' => true, 'todayHighlight' => true, 'format' => 'yyyy-mm-dd', ] ]); ?>
Rendering:
Recommended related articles and tutorials:yii tutorial
The above is the detailed content of Use of datepicker date component in yii. For more information, please follow other related articles on the PHP Chinese website!