CTimestamp problem

Hi all,

I have a strange error.

When I write:




$this->_mDateArray = CTimestamp::getDate();



or




$this->_mDateArray = CTimestamp::getDate(false,false,true);



I get :




PHP Error[2]: date_default_timezone_get(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, 

you most likely misspelled the timezone identifier. We selected 'Europe/Berlin' for 'CET/1.0/no DST' instead

    in file /Volumes/HD2/travail/www/yii/utils/CTimestamp.php at line 170



It seems to address the Yii code

Do you know how to do working this stuff ?

Thanks

You should specify the default timezone for your application via CApplication.timeZone. Or better do it inside the php.ini.

That’s more a PHP error than a Yii error. Try invoking the application’s setTimeZone method (Yii::app()->setTimeZone()) prior to retrieving the timestamp. Alternatively, you could also correct it through configuring the date.timezone property in your php.ini file.

edit: having had a look at the CTimestamp::getDate() method, that error you’re receiving really should be suppressed (more a note to the developers). It’s attempting to fetch the currently configured timezone setting, temporarily change it to GMT, and then revert back. I think displaying an error when incorrectly configured is a tad excessive, especially considering that as of PHP 5.4 it’ll stop guessing your timezone and rely solely on the value you pass through.

Either Yii should by default set the timezone setting if incorrectly configured (which is probably the most optimal thing to do), or not display the error.

Thanks all for your reply

I can’t have access to the php.ini (shared server)

I will do setTimeZone

Thanks