CJuiDatePicker dateFormat

Hello, can some one help me with CJuiDateFormat? I am using the following code:


<?php

		$form->widget('zii.widgets.jui.CJuiDatePicker', array(

			'model' => $model,

			'attribute' => 'startday',

			'options' => array(

				'minDate' => 0,

				'dateFormat' => 'mm/dd/yy',

			),

			'htmlOptions'=>array(

				'class' => 'form-control',

			),

		));

		?>

In my model -


protected function afterFind(){

		parent::afterFind();

		$this->startday = date('m/d/Y', $this->startday);

		$this->endday = date('m/d/Y', $this->endday);

	}

When I open the date picker, it is trying to do d/m/y. I have tried so many different things and can’t get it to be m/d/Y in the date picker. Anyone know the problem?

Use the language property of CJuiDatePicker.

In my config file I actually have the following set:


'CJuiDatePicker' => array(

					'language' => 'en',

					'options' => array(

						'dateFormat' => 'mm/dd/yy',

						'showAnim' => 'fold',

					),

				),

I also tried adding the language property on the specific CJuiDatePicker but it didn’t help.

Add a hidden field for startday. Remove the attribute from CJuiDatePicker and add a value property and fill it with a parsed date (base upon the value of startday) in the desired format. Add altField and altFormat. AltField points to the hidden field id, and altFormat has the format of startday.