C Formatter return today


I am new in the yii Business, so please be gent :D

Iam formatting Dates with the following Line and it works very well:


But when the $data->datum ist invalid or empty, it is getting me the todays Date… For me it would be fine if it displays nothing when de Date is empty.

What can i do? Thank you!

Which version of Yii are you using? The documentation says that null values are only checked since 1.1.11:


I am using 1.1.16

strtotime returns the current date when called without a valid date:


Try something along those lines:

'value'=>'$data->datum ? Yii::app()->dateFormatter->format("dd.MM.yyyy",strtotime($data->datum)) : ""'

Thank you!