How to get exact date and time of mysql database table update?

Hi all, I am new to web development and I am suffering from a problem to get the date and time when the mysql database table was updated because I have to show it on my web page. I get the latest updated date correctly, but not correctly, please help me.

 <?php

    $sql = "SHOW TABLE STATUS FROM MydatabaseName LIKE 'TableName'";
    $tableStatus = mysql_query($sql);

while ($array = mysql_fetch_array($tableStatus)) {
          $updatetime = $array['Update_time'];

          $datetime = new DateTime($updatetime);
          echo $updatetime ;
     }

 ?>
+4
source share
3 answers

If it can help you

SELECT UPDATE_TIME
FROM   information_schema.tables
WHERE  TABLE_SCHEMA = 'dbname'
AND TABLE_NAME = 'tabname'

How to find out when the last MySQL table was updated?

+1
source

since you noted the question in mysql.

Have you tried this? see if this is helpful.

select columns from table order by date_time column desc limit 1:
0
source

MySQL, _ .tables

 select substr(update_time,1,10) as date_updated,
        substr(update_time,12) as time_updated 
 from information_schema.tables
 where 
 table_schema = 'name_of_your_database' and 
 table_name = 'your_table_name';

, , MySQL - InnoDB. , MyISAM.

0
source

All Articles