Page 1 of 1

write out time

Posted: Fri Jun 21, 2002 3:57 am
by elhombre
:| :idea:
Hi there,

i'm a new php scripter and try to write out time continuously. i know the code that writes out the current time when the page is loaded
- $today = date("G:i:s"); - but i'd like to have it displayed as a digital clock.
is there anybody who can help me?

thanx in advance

cs

Posted: Fri Jun 21, 2002 4:22 am
by twigletmac
You'd either have to have a constant refresh of the screen (yuk) or do it with something other than PHP. PHP is server-side, therefore once the page has loaded to get a new time to be printed you have to reload the page. If you want a clock that continuously updates you need to use a client-side technology like Javascript.

Mac

Posted: Fri Jun 21, 2002 5:52 am
by elhombre
:roll:
So the only way to have it roll is to combine with javascript for example?

Posted: Fri Jun 21, 2002 5:55 am
by twigletmac
That's what I said - PHP can't do this you need to use something client side. I'm sure you'd find lots of examples of programs that can do that sort of thing by doing a search at somewhere like http://www.hotscripts.com.

Mac

Posted: Fri Jun 21, 2002 6:09 am
by elhombre
:idea: Thanks a lot :D

Posted: Fri Jun 21, 2002 11:33 am
by honkyinc
You'd need to use DHTML (HTML, CSS & JS) to make the clock dynamic. You can check out http://www.dynamicdirve.com to find one.