Hi guys, I am building an application in PHP and I have got to the stage at which I need to know how to find out the user's timezone. I'd like to know if there is a way of using the date() function to retrieve it. If there isn't a way of doing it then I will just ask the user to input their timezone.
By the way I know this can be done with JavaScript, but I just wanted to know if it is possible with PHP.
Yeah, my idea was to make it more automated than it is, but in the end I suppose a little more user input can't hurt - by the way, do you think the extended user input works?
There is a way to find the users timezone but that would require you to have an IP to location table. Map the IP address which is obtained from the
$_SERVER[\"REMOTE_ADDR\"]
variable to a location and then to a timezone. This method cannot be accurate but atleast can help users in selecting their timezones. The better method is to do using js and calculate the client offset and return it to our server.
By the way I know this can be done with JavaScript, but I just wanted to know if it is possible with PHP.
Thanks in advance.
-Tom
http://us3.php.net/manual/en/function.d ... ne-get.php
also you can show the abbreviated version with echo date(T);
this gives me BST
as far as i know this is server time, not client time
The timezone on my server is -7 and the $timeZone variable is a number given to the PHP by the users input. Thanks anyway!
the finished results of what I was doing can be found here: http://tomsbigbox.com/alive
-Tom
so really the drop down menu means you don't need to know what the users timezone is, as they can use what they like?
http://digitalpbk.blogspot.com/2009/05/crontab-server-timezone-php-date.html
You can use the putenv function in php to put an environmental variable;
putenv ('TZ=Europe/London');