简体   繁体   English

无法在 yii1 中的 cjuidatepicker 中更改用户视图的日期格式

[英]unable to change date format for user view in cjuidatepicker in yii1

$this->widget('zii.widgets.jui.CJuiDatePicker',array(
                            'name'=>'date_from',
                            'id' => 'date_from',
                            //'value'=> date('d/m/Y',strtotime($date_from)),
                            'options'=>array(
                            'dateFormat' =>'dd/mm/yy',
                            'altFormat' =>'dd/mm/yy',
                            'changeMonth' => true,
                            'changeYear' => true,                                
                            'showAnim'=>'slide',
                            'showButtonPanel'=>true,
                        ),
                        'language' => 'en-GB',
                        'htmlOptions'=>array(
                            'class'=>'form-control'
                        ),
                    ));

This is the code for the date picker so I want the user to view the date in the following format: dd/mm/yy.这是日期选择器的代码,因此我希望用户以以下格式查看日期:dd/mm/yy。 I want it seperated with slashes.我希望它用斜线分隔。

This works in Yii 1.20 with JQuery 1.11.2 I added additional parameters just as reference.这适用于Yii 1.20JQuery 1.11.2我添加了额外的参数作为参考。

 $this->widget('zii.widgets.jui.CJuiDatePicker', array(
          'model'       => $model,
          'attribute'   => 'date_from',
          'language'    => 'en',
          'options'     => array(
              'showAnim'          => 'fold',
              'dateFormat'        => 'yy/mm/dd',
              'showOtherMonths'   => true,
              'selectOtherMonths' => true,
              'changeYear'        => true,
              'changeMonth'       => true,
              'yearRange'         => "2000:2020",
              'showWeek'          => false,
              'firstDay'          => 1
          ),
          'htmlOptions' => array(
              'size'      => '10',
              'maxlength' => '10',
              'class'     => 'form-control'
          )
      ));

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM