Vince
(Vadimg88)
1
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
qiang
(Qiang Xue)
2
You should use Yii::app()->dateFormatter to format the date.
CDateFormatter is not an application component. That's why you see the error.
Vince
(Vadimg88)
3
Not sure if i am doing this right but this didn't work
return Yii::app()->dateFormatter($date, 'short', 'short');
qiang
(Qiang Xue)
4
Check this: http://www.yiiframew…n#dateFormatter
dateFormatter returns an instance of CDateFormatter.
Vince
(Vadimg88)
5
ahh ok, this worked:
Yii::app()->dateFormatter->formatDateTime($date);