Displaying time & date problem

Two ways at least:

Method 1

If you happy to accept the latest of all the wp posts ‘last modified’ as the date that the site was last updated, then you could add a function to get the latest of the ‘post_modified’ in the posts table and add that to your header.php either in the template OR add to header via a header action.

something like

$query = "SELECT MAX(post_modified) as wplast FROM `wp_posts` ;
$last_updated = $wpdb->query( $query );
echo $last_updated;

or

Method 2

if you would like a broader definition of last updated, then you’d need to add code to record that – ie Add an ‘action’ on every wordpress action that you think should count as an update. Eg: delete_post, save_post, publish_page etc See https://codex.wordpress.org/Plugin_API/Action_Reference#Post.2C_Page.2C_Attachment.2C_and_Category_Actions_.28Admin.29 and https://developer.wordpress.org/reference/functions/add_action/

something like:

function record_time () {
    $datetime = date("Y-m-d H:i:s");
    update_option('time_last_updated',$datetime );
}
add_action( 'save_post', 'record_time', 10, 3 );

The in the header or header filter/action:

echo get_option('time_last_updated');

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)