Page 1 of 3

Live Clock on a website?

Posted: Thu 16 Feb 2012 7:05 pm
by duke
I wanted to put a "live" clock on my website so visitors know what the station local time is. I down loaded and installed this.

Works well and is easily configured. But, where do these scripts get there data from? For example, how does it know when February has 29 days or BST happens?

Duke

Re: Live Clock on a website?

Posted: Thu 16 Feb 2012 7:13 pm
by b.e.wilson
Clocks like this get the time from the computer on which they run. They show the same time shown in the tray. So I'll always see my own time when I visit your page, not your local time.

Re: Live Clock on a website?

Posted: Thu 16 Feb 2012 7:20 pm
by duke
So I'll always see my own time when I visit your page, not your local time.
That's not good, I didn't realise. :bash:

So how do I go about showing a live clock that shows the time at the station and accounts for BST etc?

Duke

Re: Live Clock on a website?

Posted: Thu 16 Feb 2012 9:57 pm
by GraemeT
Hi Duke

One way would be to use the php time() function to get the time from the server and then use it to update your js clock, but it could easily get a bit messy.

Also, there might be something useful here: http://www.haneng.com/Forums_Post.asp?id=11457&p=7

Re: Live Clock on a website?

Posted: Thu 16 Feb 2012 10:05 pm
by gemini06720
duke wrote:So how do I go about showing a live clock that shows the time at the station and accounts for BST etc?
Duke, how about something like this: Analog Clock ;)

The JavaScript has the variable 'localZone' - if set to '1' the visitor's time is displayed; if set to '0' the clock can be set to display a specific timezone.

Re: Live Clock on a website?

Posted: Fri 17 Feb 2012 1:03 am
by david3
You could try here, too:

http://timeanddate.com/clocks/free.html

You can choose whatever timezone you'd like with that one, and there's a lot of customization options.

Re: Live Clock on a website?

Posted: Fri 17 Feb 2012 2:44 pm
by duke
I just tried the version at http://timeanddate.com/clocks/free.html but the digital clock will not sit correctly in the line of text :? .

Ray, that has the features I require but I'm really after a digital so I can nest it into my existing text. Do you know if there is a digital with those features as i am not finding one on that site?

Duke

Re: Live Clock on a website?

Posted: Fri 17 Feb 2012 3:10 pm
by steve

Re: Live Clock on a website?

Posted: Fri 17 Feb 2012 7:06 pm
by duke
Any use?
Yes, just the job. Thank you Steve. Even better with the date too.

Out of curiosity, where do scripts like this "GET" there data from?

Ray, your analogue clock is growing on me, I'm going to try and integrate it somewhere for a bit of nostalga.

Duke

Re: Live Clock on a website?

Posted: Fri 17 Feb 2012 7:12 pm
by steve
duke wrote:Out of curiosity, where do scripts like this "GET" there data from?
That one takes the date and time from the PC that it's running on (i.e. from the person that's viewing your site), converts it to GMT, and then applies the appropriate offset to get to the time zone that you set it to.

Re: Live Clock on a website?

Posted: Fri 17 Feb 2012 7:28 pm
by duke
Thanks, perhaps some one from outside the UK would be kind enough to click below and check for me, thanks?

Duke

Re: Live Clock on a website?

Posted: Fri 17 Feb 2012 7:34 pm
by steve
duke wrote:Thanks, perhaps some one from outside the UK would be kind enough to click below and check for me, thanks?
I'm not outside the UK, but my PC doesn't know that, so I pretended to be in Melbourne and Los Angeles, and it worked fine.

Re: Live Clock on a website?

Posted: Fri 17 Feb 2012 7:48 pm
by duke
steve wrote: I'm not outside the UK, but my PC doesn't know that, so I pretended to be in Melbourne and Los Angeles, and it worked fine.
:clap: Thanks.

Duke

Re: Live Clock on a website?

Posted: Fri 17 Feb 2012 11:34 pm
by GraemeT
Clock works for me Duke, in Firefox, IE and Chrome

Re: Live Clock on a website?

Posted: Sat 18 Feb 2012 6:56 am
by duke
Thanks Graeme :D

Duke