does anyone know if there is a way to have a live clock using php?
live clock
[man]date[/man] and [man]time[/man]
I know how to do that I'm talking about a display that shows a live clock, as in the seconds, minutes, and hours are moving according to you computer clock, without having to refresh.
the php script is only ran wen its requested. thus you need to refresh to update the time. use javascript or flash for somthing like that...
This doesn't look like a server side problem. Try a client-side solution in DHTML, javascript, flash etc
I was just wondering....
javascript clocks get their time from the client's computer - no matter how inaccurate it is, but would it be possible to 'prime' a js clock by using php to get the server time and passing the variable to the js?
Quite possibly,
but what you will find is that the date and time functions are only relavant to the actual server. so in other words... you could do it, but chances are most visitors to a website are going to be in a different timezone to the server unless its a intranet? Unless of coarse you want to go one step ahead using there IP to determine there location and then apply the required GMT
Or maybe you want to use a local time... for example, showing a time in a certain timezone, or something along those lines.
You could use setTimeout() in javascript, but I don't actually know if it's that accurate...