Hi all,
I have a CActiveForm with a date field which currently defaults to displaying ‘dd-mm-yyyy’. I would like to change this to display as ‘mm-dd-yyyy’ how can I do this?
thanks for any advice.
Hi all,
I have a CActiveForm with a date field which currently defaults to displaying ‘dd-mm-yyyy’. I would like to change this to display as ‘mm-dd-yyyy’ how can I do this?
thanks for any advice.
Are you referring to the use of CJuiDatePicker within CActiveForm or something else?
Try this date picker code
$this->widget('zii.widgets.jui.CJuiDatePicker',array(
'name'=>'datepicker-showButtonPanel',
'value'=>date('d-m-Y'), // DATE FORMAT
'options'=>array(
'showAnim'=>'slide',//'slide','fold','slideDown','fadeIn','blind','bounce','clip','drop'
'showButtonPanel'=>true,
),
'htmlOptions'=>array(
'style'=>''
),
));
My date field is within a ‘CActiveForm’ and is being created with:
echo $myForm->dateField($model,'start_date');
I’d prefer not to have to use a ‘CJuiDatePicker’.
In that case you will need to change the format of the start_date field in the controller and back to the original format before validating or saving it in the controller.
ok I’ll do that. thanks!