9

I'm finding the following error in the Recent log messages report:

Warning: DateTime::createFromFormat(): 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. in Symfony\Component\HttpFoundation\Response->sendHeaders() (line 331 of /var/www/drupal/drupal-8.1.1/vendor/symfony/http-foundation/Response.php).

My site does include any custom module, but as far as I can see, the only date function it calls is time(). Shouldn't Drupal handle the timezone setting?

Is there any way I can isolate where this function is getting called from?

It's not a major problem, but I'd prefer to minimise unnecessary warnings in my log.

3
  • There is an issue about this. I thought we added an installer warning about it. The accepted answer is correct, but there is some additional context about why it works this was. If I remember I will expand on it when I have time.
    – mpdonadio
    Commented May 21, 2016 at 20:03
  • Oh, perhaps there could be a warning in the status report in future? Commented May 22, 2016 at 2:01
  • I had a problem with this when installing 8.4.0. I wasn't able to install until I had resolved the issue (see drupal.org/forum/support/installing-drupal/2017-10-25/…). It would be great if this issue didn't break the installing :)
    – Ben
    Commented Oct 27, 2017 at 16:53

1 Answer 1

13

This is a php setting, put this into php.ini:

date.timezone = 'Europe/Dublin'

All timezones:

http://php.net/manual/en/timezones.php

0

Not the answer you're looking for? Browse other questions tagged or ask your own question.