You are here: irt.org | FAQ | JavaScript | Date | Q658 [ previous next ]
Try:
<P>Last Modified Date: <SCRIPT LANGUAGE="JavaScript"><!-- document.write(document.lastModified); //--></SCRIPT> <P>Last Modified Date (as a date): <SCRIPT LANGUAGE="JavaScript"><!-- var lmDate = new Date(document.lastModified); document.write(lmDate); //--></SCRIPT> <P>Last Modified Date using getYear(): <SCRIPT LANGUAGE="JavaScript"><!-- var lmDate = new Date(document.lastModified); document.write(lmDate.getYear()); //--></SCRIPT> <P>Last Modified date using getFullYear(): <SCRIPT LANGUAGE="JavaScript"><!-- var lmDate = new Date(document.lastModified); document.write(lmDate.getFullYear()); //--></SCRIPT> <P>Last Modified date using getCorrectedYear(): <SCRIPT LANGUAGE="JavaScript"><!-- var lmDate = new Date(document.lastModified); function getCorrectedYear(year) { year = year - 0; if (year < 70) return (2000 + year); if (year < 1900) return (1900 + year); return year; } document.write(getCorrectedYear(lmDate.getYear())); //--></SCRIPT>