Click to See Complete Forum and Search --> : Javascript needed Timezone clock


his boy elroy
02-20-2003, 05:21 PM
I am creating a new website for my small business. There is a page on the site that contains a map of the world which I created. I have made 24 seperate images (simulate the earth rotation) that I would like synchronized (GMT) to change every hour. In effect it tracks the sun as the earth rotates (timezone). you can view a static example on my site > http://edesedoret.com/company.html

Initially I thought I could create an animated gif that would change the image every 60 minutes, but that would not work. Is there Javascript that exsist that I can use? I saw a site with a similar feature and I copied part of the code:

<!-- use hour to select map image -->

<td valign="top" width="445"> <img src="/company/graphics/timezone_images/GMT_20.gif" width="471" height="253" border="0" alt="world map" usemap="#Map"></td>


Thanks in advance.

E

AdamBrill
02-20-2003, 05:34 PM
I don't think this could be done with javascript. You would have to use PHP or some other server side language. Javascript can get the time, but it gets the client side computer's time, not GMT. If you would use PHP, you could get the server time, then subtract(or add) the correct amount of time to make it GMT. Then you could just write the correct Image. I would suggest that you do it like that.

Nedals
02-20-2003, 09:34 PM
Dave, (not Charles)
THAT IS A NICE PIECE OF CODE. :)

his boy elroy
02-21-2003, 05:45 AM
Thanks everyone for replying to my thread concerning Javascript for Timezone clock. I don't think I phrased the question correctly. What I need is a script that will update the image with a new one sequentually (example: EST_01, EST_02, ect) every hour. I will upload this to my internet providers server so I don't know if it will be sequenced with the severs clock or the one from my computer prior to the page being uploaded.

Any help would greatly be appreciated.

khalidali63
02-21-2003, 07:48 AM
JavaScript is a client side scripting language,therefore, The clock it wil show will be of the system that is displaying the cloock in a browser window.

There are ffew things you will need to acquire the functionality you asked.
function DDisplay(){
1. var currDate = new Date();
2.create an hourly validation using if statement.
3.for every hour change th eimage e.g

if(hour==[hourArray[n]){
//imageDisplay code
}

Adopting this logic for timezones is mere calculations with regards to GMT time.
and since you want this to go on continously,use the setTimout function to call this method after every second.

setTimeout("DDisplay()",1000);
}

I hope this guides you..

Cheers

Khalid