symfony set timezone code example
Example: symfony set timezone
If you can’t set it in php.ini, or you want to be sure the value is consistent independently of the target environment, the easiest way is to set it in your AppBundle:
class AppBundle extends Bundle
{
public function boot()
{
parent::boot();
date_default_timezone_set("Europe/Madrid");
}
}
Alternatively, if you don’t have an AppBundle (or any other own bundle), you could add it to the AppKernel::registerBundles() method, right before the bundles are loaded.