You are here: irt.org | FAQ | JavaScript | Date | Q256 [ previous next ]
<SCRIPT LANGUAGE = 'JavaScript'><!-- function makeArray() { for (i = 0; i<makeArray.arguments.length; i++) this[i + 1] = makeArray.arguments[i]; } function getCorrectedYear(year) { year = year - 0; if (year < 70) return (2000 + year); if (year < 1900) return (1900 + year); return year; } function y2k(number) { return (number < 1000) ? number + 1900 : number; } var months = new makeArray('January','February','March','April','May','June','July','August','September','October','November','December'); var date = new Date(document.lastModified); var dateY2K = new Date(getCorrectedYear(date.getYear()),date.getMonth(),date.getDate()); var dateGMT = dateY2K.toGMTString(); document.write(months[dateY2K.getMonth() + 1] + ', ' + dateY2K.getDate() + ', ' + y2k(dateY2K.getYear()) + ', ' + dateGMT.substring(dateGMT.indexOf(':')-2,dateGMT.indexOf(':')+6)); //--></SCRIPT>