date & time format and others

why wouldn't this work:



Yii::app()->date->formatDateTime($date, 'short', 'short');
'date' => array(


            'class' => 'CDateFormatter',


        ),

it shows an error:

Missing argument 1 for CDateFormatter::__construct(), called in C:wampwwwyii-hebrewyiiYiiBase.php on line 170 and defined

You should use Yii::app()->dateFormatter to format the date.

CDateFormatter is not an application component. That's why you see the error.

Not sure if i am doing this right but this didn't work

return Yii::app()->dateFormatter($date, 'short', 'short');

Check this: http://www.yiiframew…n#dateFormatter

dateFormatter returns an instance of CDateFormatter.

ahh ok, this worked:

Yii::app()->dateFormatter->formatDateTime($date);