Yii Timezones

I followed this tutorial: http://www.yiiframework.com/wiki/197/local-time-zones-and-locales/ and did the exact same thing. For some reason I get the following error when the beforeSave is triggered:

Fatal error: Call to a member function format() on a non-object in /home/devel-snipy/protected/components/LocalTime.php on line 209

Any clues?

If you read the comments in the wiki, you’ll find these comments from herculesmorse:

To sum up, the problem seems to lay within the use of setTimezone method. In PHP 5.2, that method returns NULL on success. Starting from PHP 5.3, the method returns the DateTime object on success.

I guess you’re using PHP 5.2, in that case you could (should) change line 206 from

$servertime = $servertime->setTimeZone($this->serverDateTimeZone);