2018-07-21 10:23:18 0 评论 Yii 2.0 Boy.Lee

Yii 2 使用 时间日期选择器(Datetime picker) Demo

 1  使用 git 或者 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,
    ]     

]) ?>