php - Change Default Date to firstday of previous month -


i trying change default date first day of previous month in yii cjuidatepicker. date displaying in textfield correctly,but in datepicker popup shows current date.

code

 $model_form->suspended_date_from =date("d-m-y", mktime(0, 0, 0, date("m")-1, 1, date("y")));    $date= date('dd-mm-yy', strtotime($model_form->suspended_date_from));                        $this->widget('zii.widgets.jui.cjuidatepicker', array(                             'model' => $model_form,                             'attribute' => 'suspended_date_from',                             'htmloptions' => array(                                 'class' => 'reporttext-field fromdate',                                 'id' => uniqid(),                             ),                             'options' => array(                                  'dateformat' => 'dd-mm-yy',                                'defaultdate'=> $date,                                 // 'beforeshowday'=>'unavailable',                                   'showanim' => 'fade',                                 //'onselect' => 'js:function( selecteddate ) {$( ".todate" ).datepicker( "option", "mindate", selecteddate );}'                             ),                         )); 

how can show on datepicker popup??

you have incorect date format. dd-mm-yy (??) 1 return 1818-aprapr-1313; think incorect. if change date format d-m-y have want. whay use 2 different date format ? ("d-m-y" , "d-m-y")

$date= date('d-m-y', strtotime($model_form->suspended_date_from));                        $this->widget('zii.widgets.jui.cjuidatepicker', array(                             'model' => $model_form,                             'attribute' => 'suspended_date_from',                             'htmloptions' => array(                                 'class' => 'reporttext-field fromdate',                                 'id' => uniqid(),                             ),                             'options' => array(                                  'dateformat' => 'd-m-y',                                'defaultdate'=> $date,                                 // 'beforeshowday'=>'unavailable',                                   'showanim' => 'fade',                                 //'onselect' => 'js:function( selecteddate ) {$( ".todate" ).datepicker( "option", "mindate", selecteddate );}'                             ),                         )); 

something works me.


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -