Ask a question »

How to insert the option Last Modified to your webpage

February 2016

How to insert the option [Last Modified] to your webpage

If you are new to the web programming sphere and want to know when you have last updated your pages content, there is a very simple code, in JavaScript, that allows you to activate this feature.

Hence, all you have to do is to copy the codes displayed below in the body of your webpage and save it:


<!-- Begin
var days = new Array(8);
days[1] = "Sunday";
days[2] = "Monday";
days[3] = "Tuesday";
days[4] = "Wednesday";
days[5] = "Thursday";
days[6] = "Friday";
days[7] = "Saturday";
var months = new Array(13);
months[1] = "January";
months[2] = "February";
months[3] = "March";
months[4] = "April";
months[5] = "May";
months[6] = "June";
months[7] = "July";
months[8] = "August";
months[9] = "September";
months[10] = "October";
months[11] = "November";
months[12] = "December";
var dateObj = new Date(document.lastModified)
var wday = days[dateObj.getDay() + 1]
var lmonth = months[dateObj.getMonth() + 1]
var date = dateObj.getDate()
var fyear = dateObj.getYear()
if (fyear < 2000) 
fyear = fyear + 1900
document.write(wday + ", " + lmonth + " " + date + ", " + fyear)
// End -->
For unlimited offline reading, you can download this article for free in PDF format:

See also

In the same category

Published by jak58. - Latest update by deri58
This document entitled « How to insert the option Last Modified to your webpage » from CCM ( is made available under the Creative Commons license. You can copy, modify copies of this page, under the conditions stipulated by the license, as this note appears clearly.