Hi everyone I am new in web development and I am suffering from a problem to get date and time when mysql database table last updated because I have to show it on my web page. I am getting the last updated date correctly but not correct time 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 ;
}
?>
If this could help you
SELECT UPDATE_TIME
FROM information_schema.tables
WHERE TABLE_SCHEMA = 'dbname'
AND TABLE_NAME = 'tabname'
How can I tell when a MySQL table was last updated?
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