Here's a solution for displaying the Last-Modified date/time of the web page for BOTH html and shtml (server-parsed). I'll also include a php-solution. Let's start with html and shtml. For most servers, html is NOT server-parsed, so when the page is sent to you, the transmission has a Last-Modified variable included. But for server-parsed pages, such as shtml, that variable is NOT sent. Instead, the page designer is supposed to use SSI statements to supply the Last-Modified info, which is processed by the server before the page is sent.
Here's how to have a page handled either way, as straight html that supports Javascript, or as SSI supported shtml.
<p>Last modified:
<!--#config timefmt="%m/%d/%Y %T" --><!--#echo var="LAST_MODIFIED" -->
<script type="text/javascript" language="JavaScript">
<!--
if(Last-Modified !== undefined)
{
document.write(document.lastModified)
}
//-->
</script></p>
The "Last modified: " string is output unconditionally. Then, in server-parsed cases, the comment supplies the date/time using #config timefmt AND #echo SSI-statments. But if this isn't server-parsed, it remains just a comment. Meanwhile, for server-parsed, the variable known as Last-Modified is NOT sent, so the Javascript tests if Last-Modified is undefined, and only does something if it IS defined, which it isn't for server-parsed. CAUTION: In the comments, do NOT leave a blank after !--, and DO leave a blank before -->.
Now the flip side: straight html, not server-parsed. The SSI-statements are NOT executed, so the comment remains just a comment. But Last-Modified is defined, so now the Javescript springs into action and does the document.write to supply a document.lastModified value.
You can play around with formatting, but what's shown above is the basic code.
If the test for Last-Modified !== undefined doesn't work, then you can use a longer method:
<p>Last modified:
<!--#config timefmt="%m-%d-%Y %T" --><!--#echo var="LAST_MODIFIED" -->
<script language="JavaScript">
<!--
var mydate=new Date();
var year=mydate.getFullYear();
var month=mydate.getMonth()+1;
var day=mydate.getDate();
var hours=mydate.getHours();
var minutes=mydate.getMinutes();
var now='';
var testnow='';
var testlast=document.lastModified;
if (month<10) month="0"+month;
if (day<10) day="0"+day;
if (hours<10) hours="0"+hours;
if (minutes<10) minutes="0"+minutes;
now=(month + '/' + day + '/' + year + ' ' + hours + ':' + minutes + ':');
testnow=(now.substring(6,10)+now.substring(0,16));
testlast=(testlast.substring(6,10)+testlast.substring(0,16));
if (testlast && (testlast < testnow))
{ document.write(" "+document.lastModified); }
//-->
</script></p>
This method compares truncated versions of current-date and document.lastModified. The format of both quantities must be identical, and the substring functions drop the "seconds". What most browsers do when document.lastModified doesn't exist is substitute current-date.
Now for the php solution:
<p>Last modified:
<?php
date_default_timezone_set('America/Los_Angeles');
echo " " . date ("m/d/y.", filemtime(__FILE__));
?>
</p>
You can adjust the formatting here as well. In fact, you may want to set the timezone for your server's location. Web Search for "php list of supported timezones".