Last Updated ... (y2k compliant!)


There are a lot of "last updated" scripts available, but quite a few of them are giving some weird dates. I've been updating this script for well over three years now-- there seems to be a new glitch every New Year's Day, but I'm convinced this is the one that will make all current browsers happy with the date.

Our goal:

Stuff in this color can be changed if desired. (Month and day names may also be changed for non-English sites.) The script can go between the <BODY> and </BODY> tags.

<SCRIPT LANGUAGE=JavaScript>
<!--
/* This JavaScript was composed by Kristin J. Johnson.
*The Wererat's Lair: https://wererat.net/ */

function Array() {
for (i = 0; i<Array.arguments.length; i++)
this[i] = Array.arguments[i];}

// Array of day names
var dayNames = new
Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');

// Array of month names
var monthNames = new Array('January','February','March','April','May','June','July','August','September','October','November','December');

function y2k(number) { return (number < 1000) ? number + 1900 : number; }

function fixedYear(year) {
year = year - 0;
if (year < 70) return (2000 + year);
if (year < 1900) return (1900 + year);
return year; }

var dateError = new Date(document.lastModified);
var date = new
Date(fixedYear(dateError.getYear()),dateError.getMonth(),dateError.getDate());

document.write('This page was updated on ' + dayNames[date.getDay()] + ', ' + monthNames[date.getMonth()] + ' ' + date.getDate() + ', ' + y2k(date.getYear()) + '.');
// -->
</SCRIPT>


Grab a text file of this JavaScript (right-click and save it as a text file).