Reputation: 364
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('UTC');
1510607965 & 1510607965
But the same code is showing two different numbers on server #2:
1510607965 & 1510654765
Why would each server be different?
Upvotes: 0
Views: 467
Reputation:
The first argument to strtotime()
is supposed to be a string representing a timestamp, like 'Mon, 13 Nov 2017 15:30:24 -0800'
or '2017-11-13 15:30:24'
. Passing the name of a time zone to this function, like 'UTC'
, will not yield a meaningful result.
Upvotes: 1
Reputation: 364
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.
Upvotes: 0