write out time

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
elhombre
Forum Newbie
Posts: 3
Joined: Fri Jun 21, 2002 3:57 am
Location: Magyarország

write out time

Post 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
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post 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
User avatar
elhombre
Forum Newbie
Posts: 3
Joined: Fri Jun 21, 2002 3:57 am
Location: Magyarország

Post by elhombre »

:roll:
So the only way to have it roll is to combine with javascript for example?
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post 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
User avatar
elhombre
Forum Newbie
Posts: 3
Joined: Fri Jun 21, 2002 3:57 am
Location: Magyarország

Post by elhombre »

:idea: Thanks a lot :D
honkyinc
Forum Newbie
Posts: 19
Joined: Tue Jun 04, 2002 10:30 am
Location: Maryland, USA

Post 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.
Post Reply