Click to See Complete Forum and Search --> : how to add a simple World Time clock?
mameha1977
10-19-2007, 01:23 AM
I want to put a simple text based clock on my website that shows world time like this:
London: 01:00
USA (NY): 21:00
Tokyo: 10:00
etc...
The format is not so important, but it must be simple. I want about 8 specified countries on there.
I tried to find a free 'put world time on your website' type service but couldn't find anything suitable (ie. i need only the data, not ads and site navigation etc).
Is there some easy way to do it with javascript? If so, it needs to be all in the <body> tag as I cannot amend the <head> for this application.
Alternatively, we would pay for a web service if it is very cheap.
Any recommendations?
kiwibrit
10-19-2007, 02:55 AM
I would probably use this clock (http://ashearer.com/software/web-tools/clock/), which is a combination of Javascript and server-side coding.
I would also post Javascript questions in the Javascript section of this forum, not the HTML one.
bals28mjk
10-19-2007, 04:51 AM
I would also post Javascript questions in the Javascript section of this forum, not the HTML one.Mameha1977 was just after the best answer and part of your solution used server side. Don't be a dingus.
kiwibrit
10-19-2007, 07:44 AM
Mameha1977 was just after the best answer and part of your solution used server side. Don't be a dingus.
Not heavily into personally abusing other forum members - I hope you are not either, normally.
Javascript does not much interest me. I know it interests many others - and I am happy they have their section. More and more, lately, I have found myself wading through Javascript queries here - I find it tedious. If it continues, I shall probably ditch this forum -which will, of course continue happily without me. However, I do find it a pity that posters cannot be bothered to post to the section most appropriate.
Is there some easy way to do it with javascript?
Looks to me like mameha1977 expected a Javascript solution.
bals28mjk
10-19-2007, 08:19 AM
Not heavily into personally abusing other forum members - I hope you are not either, normally.Sorry, did I hurt your feelings?
bals28mjk
10-19-2007, 08:19 AM
Looks to me like mameha1977 expected a Javascript solution.If you think that's what he wanted why did you give him server side code? If you don't want to be a dingus don't act like one :rolleyes: .
If you think that's what he wanted why did you give him server side code? ... .
Let's keep the focus on answering the question and not have personal attacks. If you have a solution, then give it.
You could take something like this (http://www.javascriptkit.com/script/script2/dropworldclock.shtml) and change it to display each one. Here's (http://rainbow.arch.scriptmania.com/scripts/roundclock.html) another one.
This one (http://www.arachnoid.com/lutusp/worldclock.html#help) is probably better suited to what you want. The code is here (http://www.arachnoid.com/javascript/worldclock.js).
Lazer
10-19-2007, 01:15 PM
Hi.
Using JavaScript will set the clock according to the BROWSER's PC clock and NOT to the real world clock so you have to use your SERVER's clock.
If your server rund PHP it is very easy!
use date() command and make it into a JS variable.
somthing like:
<?php echo "<script>var time = date("M jS, Y, G:i O");</script>" ;?>
or change the time format to your needs. goto devguru (http://www.devguru.com/technologies/php/6024.asp) to learn more.
in JS bulid a simple clock and calculate time zonez per your needs.
GoodLuck!
Lazer
10-19-2007, 02:21 PM
Hello agin.
You can see a demo of a clock I wrote at:
http://www.elc-music.com/test/js-clock.php
You can also download it from this page.
GoodLuck!
Major Payne
10-20-2007, 02:25 AM
Might be interesting and another option: Personal World Clock Configuration (http://www.timeanddate.com/worldclock/setpersonal.html).
Ron
mameha1977
11-16-2007, 01:30 AM
I ended up doing this PHP instead.