I made a small test page here since users on our system are reporting that the times they are seeing are incorrect. We are using date_default_timezone_set()
with a value coming from a configuration file.
So what I tried is making this page:
echo 'TimeZone: ' . date_default_timezone_get() . "<br>";
echo 'Date & Time: ' . date('Y-m-d H:i:s');
----------------------------------------------------------
TimeZone: America/Chicago
Date & Time: 2020-04-07 13:33:20
And the output I'm getting is wrong however, at the time of running the time I should have gotten is 07:33 instead of 13:33 which is the time in Europe.
I thought there was something wrong with configuration or similar, so I tried adding the default timezone before the script as well, but that's returning the same wrong results:
date_default_timezone_set('America/Chicago');
echo 'TimeZone: ' . date_default_timezone_get() . "<br>";
echo 'Date & Time: ' . date('Y-m-d H:i:s');
-------------------------------------------------------
TimeZone: America/Chicago
Date & Time: 2020-04-07 13:37:24
Again, this time the time should be 07:37 in the actual timezone, but the date function is not returning the right function.
I saw another question here that it was something related to the server time, but it's set to the same thing as the previous hosting company that we had, using CentOS as well, so that doesn't seem to be the issue here.