I have a situation where I want the server time to be displayed on a web page. At present I keep it simple and just do this
<?php
$CTIME=date ("g:i a");
?>
This works great- except I would prefer it if it updated by itself without the need to refresh the page. I was thinking perhaps there is a way I can set the javascript time function with the time from a php script- but I've got no idea as to how I could go about doing this.
Perhaps I'm thinking about this wrong... maybe there is another solutions I'm not thinking of, Any ideas ??
Here is a jQuery plugin for displaying a clock:
http://plugins.jquery.com/project/jqClock
Just initialize it using the time coming back from the server. It automatically updates every second on the client side.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With