Date Modified
JavaScript Code for You


Date Page was Updated
better method
full year
leading zeros
leading zeros, full year
European format
Additional Information
Click on any green divider line to return here.

 

Date Page was Updated


<SCRIPT Language="JavaScript">
<!-- hide from old browsers
    document.write("Updated: " + document.lastModified)
//-->
</SCRIPT>

 

Date Page was Updated (better method)


<SCRIPT Language="JavaScript">
<!-- hide from old browsers
  var modDate = new Date(document.lastModified)
  var modYear = modDate.getYear()
  if(modYear<1000) modYear+=1900
       
  document.write("Updated: " + (modDate.getMonth()+1) + "/" + 
                  modDate.getDate() + "/" + (modYear+"").substring(2,4))
//-->
</SCRIPT>

 

Date Page was Updated (full year)


<SCRIPT Language="JavaScript">
<!-- hide from old browsers
  var modDate = new Date(document.lastModified)
  var modYear = modDate.getYear()
  if(modYear<1000) modYear+=1900
       
  document.write("Updated: " + (modDate.getMonth()+1) + "/" + 
                  modDate.getDate() + "/" + modYear)
//-->
</SCRIPT>

 

Date Page was Updated (leading zeros)


<SCRIPT Language="JavaScript">
<!-- hide from old browsers
  var modDate = new Date(document.lastModified)
  var modMonth = modDate.getMonth()+1
  var modYear = modDate.getYear()
  var modDay = modDate.getDate()
  if(modDay<10) modDay = "0" + modDay
  if(modMonth<10) modMonth= "0" + modMonth 
  if(modYear<1000) modYear+=1900
       
  document.write("Updated: " + modMonth + "/" + modDay +  
                  "/" + (modYear+"").substring(2,4))
//-->
</SCRIPT>

 

Date Page was Updated (leading zeros, full year)


<SCRIPT Language="JavaScript">
<!-- hide from old browsers
  var modDate = new Date(document.lastModified)
  var modMonth = modDate.getMonth()+1
  var modYear = modDate.getYear()
  var modDay = modDate.getDate()
  if(modDay<10) modDay = "0" + modDay
  if(modMonth<10) modMonth= "0" + modMonth 
  if(modYear<1000) modYear+=1900
       
  document.write("Updated: " + modMonth + "/" + modDay +  
                  "/" + modYear+"")
//-->
</SCRIPT>

 

Date Page was Updated (European format)


<SCRIPT Language="JavaScript">
<!-- hide from old browsers
  var modDate = new Date(document.lastModified)
  var modYear = modDate.getYear()
  if(modYear<1000) modYear+=1900
     
  document.write("Updated: " + modDate.getDate() + "." +
                 (modDate.getMonth()+1) + "." + (modYear+"").substring(2,4))
//-->
</SCRIPT>

 


Additional Information on These Scripts


All scripts are Y2K compliant.

Some servers do not allow you to freely get the modified date for a file. The script may give accurate readings for some browsers and be inaccurate on others. So, check this script on your server with all browsers before you adopt it.




Date & Time     Clocks