PDA

View Full Version : Last modified page


Hirameck
03-12-2003, 07:12 PM
Hi!
I used the script to list the latest time it has been updated.
I do not need the time to be included but only the date.


<SCRIPT TYPE = "text/javascript">
<!--
if(Date.parse(document.lastModified) !=0)
document.write
("Page last updated: " + document.lastModified);
//-->
</SCRIPT>

Thanks.
:(

joh6nn
03-12-2003, 07:32 PM
var lM = new Date(document.lastModified);

var lM_y = lM.getFullYear();
var lM_m = lM.getMonth();
var lM_d = lM.getDate();

lM_m = (lM_m * 1) + 1;

if (lM_m < 10) { lM_m = '0' + lM_m; }
if (lM_d < 10) { lM_d = '0' + lM_d; }

document.write("Page last updated " + lM_m + "/" + lM_d + "/" + lM_y);

i believe i got that code from Jalarie here in the forums

jalarie
03-13-2003, 08:41 PM
joh6nn, Thanks for the reference, but I don't think that I deserve it. That might be someone else's work that I modified to do what you wanted, but it's not my original. I normally use getYear and then adjust it to take care of the Microsoft stupidity if necessary rather than getFullYear. Nothing against MS, just personal preference.
:o

joh6nn
03-13-2003, 11:51 PM
i'm pretty sure i got it from you. i would have added getFullYear myself, probably.

if i didn't get it from you, though, then i have to wonder who i did get it from.

jalarie
03-14-2003, 12:56 PM
OK, I guess I'll just stick with a simple "Thank you" for the reference. :D