W
W
wowbate2021-07-28 14:27:34
symfony
wowbate, 2021-07-28 14:27:34

How to specify date_default_timezone_set in Symfony?

I have Symfony 5
I call a function date_default_timezone_set()in Kernel.php:

public function __construct(string $environment, bool $debug)
    {
        // часовой пояс по умолчанию
        date_default_timezone_set('UTC');

        parent::__construct($environment, $debug);
    }


How can I make it so that I take the time zone from .env.local

That is

public function __construct(string $environment, bool $debug)
    {
        // часовой пояс по умолчанию
        date_default_timezone_set('тут указать ключ из env');

        parent::__construct($environment, $debug);
    }

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim, 2021-07-28
@wowbate

You can use the getenv() function if that's what you want.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question