Here is the code. This code can be added to any file. Before using this you can read the tutorials on how to get the file name and filemtime() function.
$file = $_SERVER["SCRIPT_NAME"];
$break = Explode('/', $file);
$pfile = $break[count($break) - 1];
//echo $pfile;
echo "This file was last modified on: " .date("d/m/Y",filemtime($pfile));