Forum Moderators: coopster

Message Too Old, No Replies

Finding Visitors Time

         

otem

1:40 am on Feb 27, 2007 (gmt 0)

10+ Year Member



I'm trying to display different content to my visitors based on their timezone. I can do something similar in JavaScript, but JavaScript will not be appropriate in this situation so I'm hoping PHP might offer a similar function.

For what its worth, accuracy is does not need to be 100%, and I would prefer false positives than false negatives.

Any ideas?

Thanks.

eelixduppy

3:41 am on Feb 27, 2007 (gmt 0)



PHP does not have a function that automatically gets the visitors timezone; it is a server-side technology (unlike javascript). You are either going to have to have the visitor set their time zone, or make a guess based on their ip's location. Sure this can be done, and I'm sure there might even be little scripts out there for this. Try the script repositories to see what comes up: hotscripts, sourceforge, phpclasses, etc...

Good luck! :)

rokec

8:10 pm on Feb 27, 2007 (gmt 0)

10+ Year Member



You can use javascript on main page to get time and save it to cookie. Then on second page you easily read that cookie with php.