Re: Finding user's timezone

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

 



Dotan Cohen wrote:
> On 03/11/06, Richard Lynch <ceo@xxxxxxxxx> wrote:
>> On Fri, November 3, 2006 6:09 am, Dotan Cohen wrote:
>> > How does php decide what timezone a user is in? Although I am in
>> > Haifa, Israel (GMT+2), when I go to a page with date("e") I get
>> > "America/New_York" displayed.
>>
>> I could be wrong, but I think date('e') tells us where your SERVER is.
>>
>> Or, more accurately, what time zone your server was configured to tell
>> us it lived in, no matter where it really lives in the physical world.
> 
> Yes, this seems to be the case.
> 
>> > To confirm, could some users tell me what output they get on:
>> > http://what-is-what.com/what_time_is_it.php
>> >
>> > Let me know where you are in the world, and what timezone you are in
>> > to confirm/ deny the correctness of the php date function. Any advise
>> > on how to get the correct user's timezone would be most appreciated.
>>
>> The function is correct.  Your understanding of its purpose is incorrect.
> 
> Figures. Just like calculus :)
> 
>> date('e') is there so that the server can know what time zone *IT*
>> lives in, not what time zone *I* live in.
>>
>> There is a reason why all those web forums let you set your time zone
>> in your preferences... :-)
> 
> Actually, there are those who have it already filled it. Take for example:
> http://extremetracking.com/?reg

that server seems to be in holland (so am I) and it's not even giving me the correct
selection. my guess is they either set the TZ to the servers TZ or take some kind of guess (ip database?).

I would use javascript to determine the user's local TZ by comparing a timestamp
written into the javascript output with the current time given by the javascript Date object ...
you can then offer a pre-selected TZ value in a selectbox.

just a thought
> 

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