View Full Version : International Time Script
bmdavis
10-24-2004, 04:49 PM
I have noticed a few scripts on the page that display clocks on the web page. Any way you can change the script to display the time in, for example, London?
Thanks.
cr3ative
10-24-2004, 05:14 PM
Yes, I could modify a script for you. It would take the user's system time and modify it by +x or -x hours.
Pick any clock script, with a llink to it here if this is what you mean.
cr3ative
bmdavis
11-04-2004, 05:28 AM
http://www.dynamicdrive.com/dynamicindex6/clock3.htm
Just tell me where to edit.
Also, will it make a different if people are accessing it on different coasts of the U.S.? (can you just add a simple +8 for London?)
cr3ative
11-04-2004, 08:48 AM
var hours=mydate.getHours()+1
Would add one hour to this script.
cr3ative
ddadmin
11-04-2004, 08:10 PM
It's actually a little more complicated than that, unfortunately. Since you have no idea what time zone the user is in, you'll need to use either the Date.getTimezoneOffset() function (http://www.javascriptkit.com/jsref/date.shtml) or some other fixed time function to eventually determine the current time that doesn't change regardless of what the user's timezone is. Unfortunately due to time constraints I can't make the modications for you, though try searching on Google for such an example...
cr3ative
11-05-2004, 12:36 PM
Well yes, ideally it would get the time from a world time server, but they all seem to have no support for projects like this.
I forgot to mention that it relies entirely on the system clock :(
cr3ative
ddadmin
11-05-2004, 06:53 PM
Well yes, ideally it would get the time from a world time server, but they all seem to have no support for projects like this.
I forgot to mention that it relies entirely on the system clock :(
cr3ative
Yep, if your page is PHP for example, you can use PHP to write out a variable in JavaScript containing the system clock, then simply increment that by x hours depending on the World time you want to display.
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.