I tried to set the timezone in AppKernel.php
public function __construct($environment, $debug)
{
date_default_timezone_set("Europe/Berlin");
parent::__construct($environment, $debug);
}
but it does not work i am getting this error:
Notice: Object of class Symfony\Bundle\FrameworkBundle\Templating\TemplateReference could not be converted to int
i have cleared cache many times, if i remove the above code then i get following error:
*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 the timezone 'UTC' for now, but please set date.timezone to select your timezone.*
Note: the application work perfectly on my machine but i need to deploy the code on Test server I am getting this error
You can set the default time zone on your php.ini
date.timezone = "Europe/Berlin";
Another way
class AppKernel extends Kernel
{
// Other methods and variables
// Append this init function below
public function init()
{
date_default_timezone_set( 'Europe/Berlin' );
parent::init();
}
}