Page 1 of 1

Different Time zone

Posted: Sat Jun 05, 2004 2:57 pm
by anjanesh
Hello
I have a site which will display today's date. But the data center is located somewhere in US and the time zone in india is different (+5:30GMT) so the date shows some 10hrs behind. I can add the lost hrs but then the site would display the correct date in india only. How do I get this to show the correct date in any part of the world using their time zone ?
Anjanesh

Posted: Sat Jun 05, 2004 3:04 pm
by launchcode
You'll have to get the local time of the client via JavaScript and then feed that back to your PHP script which will remember it for them. Then of course just hope they've got their computer clock set correctly :) PHP itself cannot detect this.

Posted: Sat Jun 05, 2004 6:07 pm
by qads
if you got a membership thing going on your site then ask the users to choose a timezone like this forum does :).

Posted: Sat Jun 05, 2004 9:24 pm
by anjanesh
Is not possible to find out from which country the page is being requested by getting the ip and finding out the country ?

Posted: Sat Jun 05, 2004 9:51 pm
by launchcode
There's no foolproof way to do that - say you reverse an IP to AOL - does that tell you where in the US they are for example? East coasters wouldn't have much use for west coast time zones (etc).