Re: Finding user's timezone

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

 



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.

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

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... :-)

> Note: I have considered matching the users' IP against a database, but
> I'd prefer a simpler method, without the overhead of such a database.
> Thanks in advance.

Put it this way:

If the info you want about me and my computer isn't in this output:
<?php phpinfo();?>
then you probably cannot get it.

If you *do* use the IP->country db, please allow a manual override for
those users whose IP is wrong in the db, or who are using some kind of
proxy for whatever reason.

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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