Live clock with PHP

I am interested in having a “live clock” on my webpage, so it goes automatically. Like a digital clock. Don’t have any idea how to do this, but I guess it includes something with “date” function in PHP…hope anyone have any clues out there.

Regards

Anagram (www.angram-studios.net)

PHP is a server-side scripting language. You need to use something like javascript to have a client-side clock. You can find loads of examples at places like hotscripts.

Matt.

EDIT: here’s a link:

http://www.hotscripts.com/JavaScript/Scripts_and_Programs/Date_and_Time/

Here is a couple of good sites that you may find useful:
http://www.dynamicdrive.com
http://javascript.internet.com

Thx thx ppl. It helped. Seemed like I had to use Javascript instead of PHP. But What if you keep on refreshing, lets say an iframe all the time with a PHP echo date function in it? Wouldn’t that work?

yes, but it would mean sending data a lot from your server = more bandwidth = bad in most cases.

javascript is the method of choice in this case. (It is always the clients exact time with javascript as well)

That would be a waste of resouces, and as cyborg from dh stated, javascript will keep an accurate time on the webpage, as it runs off of the users computer. Using php for this wouldn’t be effective at all, and would just run up your bandwidth enormously.