0

Hello,
I have a time field saved in database in GMT format. I need to convert it to the visitor's local time.

Is there a way to figure out the vistor's region/time?
Should I be looking into javascript for this?
I thank you in advance for your help.

3
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by Aamit
0

Most web sites ask you because there's no way to trust browser settings, or what the user wants to see.

You could check their IP, get geo location, and do a look up.

But if you don't mind trusting data that you shouldn't, you could use javascript: date.getTimezoneOffset()

-2

There is 1 simple way.

1> while in registration form of user ask for time zone.
Drop down for Like GMT 5, GMT +5.30, PST ...all
store in DB in user record table .

2> Download php pear and install
when user log in pass the GMT +5.30 or PST time to variable in Pear function
you will get automatically local time of user.

read the PHP Pear
http://pear.php.net/package/PEAR/download

Hope it helps you

Edited by Aamit: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.