Re: Dates ahead of time on PHP
| From: | Richard | Date: | Sun, 07 May 2023 22:21:29 +0000 |
| Subject: | Re: Dates ahead of time on PHP | ||
| References: | 1 2 3 4 5 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-328200@lists.php.net to get a copy of this message | ||
> Date: Sunday, May 07, 2023 15:17:00 -0400
> From: paulf@quillandmouse.com
>
> On Sun, 7 May 2023 18:19:59 +0000
> Jānis Elmeris <janis.elmeris@lv.lv> wrote:
>
>> Was that setting unset also in your previous configuration? What
>> PHP version was the previous one?
>
> Not sure the previous version. But no, it wasn't set in the prior
> Debian installation. The value was commented out in the php.ini
> file.
The standard approach with most [application] config files is that if
a setting is commented out it will use the [application] default
(sometimes these are shown, sometimes not). The default for
"date.timezone" is UTC:
<https://www.php.net/manual/en/datetime.configuration.php#ini.date.timezone>
There used to be a warning when that value wasn't set in the .ini,
and so the default was used, but that was removed in 7.0:
<https://www.php.net/ChangeLog-7.php>
It looks like prior to 5.4 a TZ "guessing algorithm" was used if the
date.timezone value wasn't set in the .ini. That was removed in 5.4
(march 2012), with UTC set as the default:
<https://www.php.net/ChangeLog-5.php#5.4.0>
So, the default has been UTC since 5.4, with the warning (if no value
was set) in place from 5.4 to 7.0. There was actually a warning to
not trust the system's timezone setting prior to 5.4.
For ease of consistency I have always run all my servers as UTC,
regardless of where they are located.