M
M
Maxim Morozov2014-11-10 17:45:51
PHP
Maxim Morozov, 2014-11-10 17:45:51

Where does PHP get the timezone from on Windows?

There is a test machine with a web server under vin7 with the latest updates. There is PHP 5.4.30 which outputs in response to such a script

...
?><pre><? print_r(new DateTime()) ?></pre><?
...

displays
DateTime Object
(
[date] => 2014-11-10 18:42:52.000000
[timezone_type] => 3
[timezone] => Europe/Moscow
)

Although the system is now 17:42. How to force PHP to update timezone data?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Maxim Morozov, 2014-11-11
@murzix

I will answer myself - in version php 5.4.34 the problem is fixed

B
Boris Benkovsky, 2014-11-10
@benbor

Is it the first line in the script? Maybe you have a time zone of +2, and above in the scripts somewhere it is written
ini_set('date.timezone' , "Europe/Moscow"); Then PHP can translate the time. Plus, another web server (IIS or whatever you have) can set the time. Go through the chain, see that the time zone matches everywhere. Also run in the console php -r 'var_dump(new DateTime());'

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question