You will need to transfer the current server time to the page as it is created and use JavaScript to initialize your clock. Fortunately, the JS Date object will take a timestamp (in milliseconds) for initialization, so it's simple:
<script type="text/javascript"> var d = new Date(<?php echo time() * 1000 ?>); </script>
Pay attention to the part * 1000
. PHP timestamps are in seconds, and JS is in milliseconds.
source share