Date Modified Written Nicely

[Total: 0    Average: 0/5]

This shows how to nicely format the date output for the document modified date.

Head Code:

<script>
var bName = navigator.appName; 
var bVer = parseInt(navigator.appVersion); 
var IsIEPlus = false; 
var IsNSPlus = false; 
var Others = false; 
if ((bName == "Netscape") && (bVer >= 3)) { 
    IsNSPlus = true; 
} else if ((bName == "Microsoft Internet Explorer") && (bVer >=4)) { 
    IsIEPlus = true; 
} else Others = true; 

function showDate() { 
var modify_day = new Date(document.lastModified); 

var theMonth = modify_day.getMonth()+1; 
var theDate = modify_day.getDate(); 

var theYear = modify_day.getYear(); 

if (!IsIEPlus) { 
if (theYear <= 100) { 
theYear +=1900; 
} 
} 

document.write('<font face="helvetica,arial" size = -1>'); 
document.write('<center>'); 
document.write('  <b>Last updated: </b>' + theMonth+'/' + theDate + '/' + theYear + '<br>'+'</center></font>'); 

document.close; 
}
</script>

Body Code:

<script>
// place this statement where you want the output to appear in the html file.
showDate();
</script>

Times Viewed: 1

Leave a Reply

Your email address will not be published. Required fields are marked *