i haved tried use CJuiDatePicker but not change this value always 1970/01/01 07:00:01 AM
this my code
<div class="row">
<?php echo $form->labelEx($model,'time'); ?>
<?php $this->widget('zii.widgets.jui.CJuiDatePicker', array(
'model'=>$model,
'attribute'=>'time',
'options'=>array(
//'showAnim'=>'slideDown', // 'show' (the default), 'slideDown', 'fadeIn', 'fold'
'showOn'=>'button', // 'focus', 'button', 'both'
'buttonImage'=>Yii::app()->request->baseUrl.'/images/calendar.png',
'buttonImageOnly'=>true,
'htmlOptions'=>array('readonly'=>"readonly"),
'changeMonth'=>true,
'changeYear'=>true,
'mode'=>'datetime',
'dateFormat'=>'dd/mm/yy',
'htmlOptions'=>array(
'size'=>43,
'value'=>(!empty($model->time))?(is_numeric($model->time))?date('d/m/Y',$model->time):$model->time:date('d/m/Y')),
)));?>
<?php echo $form->error($model,'time'); ?>
</div>
can you help me?
i know why the result only 1970/01/01 it is system time (http://en.wikipedia.org/wiki/System_time ) but i cann’t change it to really time. (T.T) can you help me?
the result it’s enter in database. but the result it always use year 1970 but the minutes is change … date year and month not change. i think it is about time system what are you think?
gustavo i know why my code error . but i always can convert unix_time_stamp (197001/01 …) in really time. i use your code is work but canc’t convert it to really time …
thanks gustavo. it is work very well. i have mistake. in fact the atribut can save to database it is make me assume that it is n’t work. i must repaire my controller and model why cann’t save to database. what are you think
Ok i tell the story. if i use $time=mktime(0,0,0,$month,$day,$year); it is cann’t save in database so i make new attribute to temporary ($_time). and the really $time i change it’s type to integer. and $time=$_time and it is work. thank you want to help me.
code i am edit
[EDIT]
public function beforeSave()
{
$this->timeCreate=$this->timeCreate=time();
$temp=date('Y/m/d',strtotime($this->_time));
list($year,$month,$day)=explode("/",$temp);
$temp=mktime(0,0,0,$month,$day,$year);
$this->time=$this->time=$temp;
return parent::beforeSave();
}