phpdatetimeutcstrtotime

PHP strtotime('UTC') different on another server


I have two different servers with a copy of the same PHP website.

Both servers are using the same timezone 'Pacific/Auckland'.

This code shows the same two numbers on server #1:

echo time();
echo strtotime('2017-11-13 21:19:25 UTC');

1510607965 & 1510607965

But the same code is showing two different numbers on server #2:

1510607965 & 1510654765

Why would each server be different?


Solution

  • Both servers were using the same version of PHP but one of them had a problem with the timezone database.

    I installed a new timezonedb and server #1 is showing the correct UTC time now.