- This topic is empty.
Viewing 10 posts - 1 through 10 (of 10 total)
Viewing 10 posts - 1 through 10 (of 10 total)
- The forum ‘Back End’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
hi everybody
i’m using this code to display date and time
echo date ("l jS of F Y H:i:s", mktime (date("H")-8,date("i"))) ;
?>
my simple question is how can i refresh the seconds every seconds?
i searched for javascript or ajax solution but nothing good for me
thanks
i need it for wordpress
i have already on body a tag onload()
You can use the javascript file TheDoc linked to in wordpress as well I’m sure.
Just upload the file to a directory on your website server. Then just the source to the right path:
If you want it to run a clock that updates every second, your answer is javascript – not PHP.
PHP is a server side language – thus run on the server.
Javascript is a client side language, and lets the users browser do the work.
There is absolutely no point in making a clock ajax/php based. You are making a bunch of useless http requests, and the time would even jump several second intervals on poor connections.
I have use:
Just change the city where live so that you can have it running at least minute by minute (not seconds)
TheDoc is right.
http://www.dynamicdrive.com/dynamicindex6/clock2.htm
Just include the javascript files in your header like so
Then initialize it. It doesn’t have to be on your body tag.
Hope that helps.
The javascript solution will show the computer’s time. Not the actual time. The php way, will show the actual time in the city.
Can you use PHP to get the time initially, and then use javascript to change the time
May I ask what you need the time for?
I have a hard time figuring out what the purpose of the site would be, if the clock is a killer feature.
Excuse me, but why is it interesting to the user? No matter what O/S you use, you will have a clock in your taskbar or whatever.
Unless your remaking http://www.time.is it does not seem to be worth an effort ;-)