That is because javascript reads when the document was last modified on clients side, eg. when it was loaded, eg. the current time. It can't display info about a file on server side.
To display last modified time of a file, use something like this (PHP):
PHP:
<?
printf("This file was last modified on %s.",date("Y. m. d. H:i",filemtime(basename($_SERVER["PHP_SELF"]))));
?>
Only things that you might want/need to change are
basename($_SERVER["PHP_SELF"]) to path to your file in case you don't want to show last modified time of file currently accessed, and date formatting.