PDA

View Full Version : Help With Time Offset and Dynamic Countdown Script



c0rkscrew
08-09-2008, 12:36 AM
1) Script Title: Dynamic Countdown Script

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex6/dhtmlcount.htm

3) Describe problem:

I am currently running this script on a website creating various countdown timers for actions. I've written my scripts in php. The problem I'm running into is that my server clock is set to CST (GMT -6) and people are using my site from various locations around the world so the timers are really only working correctly for people who have their system clocks set to CST.

For example, if the timer is supposed to count down to 5 minutes from "x" time, people whose time is EST are seeing their timer display 65 minutes instead of 5 minutes. Is there a way to adjust for this offset via JS or a combination of PHP/JS without having them declare their locale via the PHP scripts? I've seen scripts using getoffset() (I think that's what it is) but I can't seem to figure out how to do this with this particular script.

From what i understand, the Universal Countdown Script http://www.dynamicdrive.com/dynamicindex6/universalcountdown.htm can adjust for offset time, but for the life of me (I'm JS dumb) I can't figure out how to adjust the script in question to work like the universal Countdown Script.

Any help would be much appreciated on this.

ddadmin
08-09-2008, 06:08 AM
Universal Countdown script (http://www.dynamicdrive.com/dynamicindex6/universalcountdown.htm) is what you'll want to use actually. Using JavaScript alone to calculate timezone offsets isn't reliable (at least I haven't found a consistent technique), hence the later script was created, which relies on either SSI, PHP, ASP, or frankly any serve side feature to get the time of the server and use that as the basis.

c0rkscrew
08-12-2008, 01:07 AM
Thanks, that does exactly what I want without having to make many changes on my end with my pre-existing system. Thanks again.