Re: Why does PHP consider the system's timezone unreliable, and is date_default_timezone_set() required?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 17 Feb 2014 at 16:46, Stuart Dallas <stuart@xxxxxxxx> wrote: 

> On 17 Feb 2014, at 13:14, Martin Tournoij <martin@xxxxxxxxxx> wrote:
>
>> Is this somehow unreliable? This is all POSIX stuff, so I would expect it to
>> work well on at least all POSIX sysyems, or am I missing something?
>
> It doesn’t mean unreliable in the technical sense, just that it’s very
> common for the timezone of a server to be different from the timezone you
> want, so it forces you to make a choice. This issue extends beyond shared
> hosting to dedicated servers where the person who set it up hasn’t changed
> the timezone from the default. PHP is simply reminding you to check that the
> timezone is what you want it to be rather than being surprised when it appears
> that the time is wrong.

That may be a reasonable thing to do if your PHP is executing on a server. In my case it's on a user's machine and obtaining what the system thinks is the timezone value, just so I can tell PHP, has proved to be a pain in the bum. At least under unix (and so OS X) it seems I can look at what:

  /etc/localtime

(which is a link) equates to. I couldn't find any reliable way at all to do it under Windows.

People shouldn't assume that all execution of PHP takes place on a server, because it doesn't.

--
Cheers  --  Tim

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux