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 17:46, Stuart Dallas <stuart@xxxxxxxx> wrote: 

> On 17 Feb 2014, at 17:27, Tim Streater <tim@xxxxxxxxxxxxxxxx> wrote:
>
>> On 17 Feb 2014 at 17:04, Stuart Dallas <stuart@xxxxxxxx> wrote: 

>>> date_default_timezone_set(@date_default_timezone_get());
>>
>> This just gives me UTC, not the timezone the user has set.
>
> Sorry, I didn’t have time to test it. I don’t know what else to suggest.
> If these are local CLI scripts for your own usage, why not just hardcode
> timezone? If the timezone is actually important for your scripts you can
> instead set the timezone in your local php.ini which will make it correct
> unless you ever travel and need it to be local, at which point I’d wonder
> what you’re doing that needs such a reactive timezone value.

The app is an email client. So it runs wherever the user is (all parts of the app run on the user machine, including apache and the PHP scripts). So I can't hardcode it. As I described earlier, for OS X and unix I have a way to get it; it's Windows that's the problem. When I get a round tuit I'll add a user setting so they can enter it themselves.

--
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