Are there any best practices for efficiently updating timestamps on a webpage using PHP and JavaScript?

When updating timestamps on a webpage using PHP and JavaScript, it is important to ensure that the timestamp is accurate and reflects the current time. One way to efficiently update timestamps is to use AJAX to asynchronously fetch the current timestamp from the server and then update the timestamp on the webpage without requiring a full page refresh.

<?php
// PHP code to get current timestamp
echo time();
?>