Fenster
09-03-2003, 05:33 PM
Ive been trying to create a script that shows the last time the page was updated, so far I managed, but I also tried to get the latest update date to be replaced by a text instead of numbers in a certain case: If the the page was updated the same day that its viewed the "last updated" would say Today instead of 03/04/2003 (or whatever) so it should compare the "last update" with the time, date on the local machine.
Is there some way of doing this? I been tring to fix it but Im just goin´ round in circles and its been ages since last programmed javascripts, theres probly some really easy solution to this but my brain has totally locked up so I would really need some advice and help with this.
Well heres the script as far as I managed:
<SCRIPT LANGUAGE="JavaScript">
<!-- Start
var mydate=new Date()
var dd = "<b>Last Update</B> " + document.lastModified;
var z = dd.length-8;
var day=mydate.getDay()
var month=mydate.getMonth()
var daym=mydate.getDate()
var localTime = "<b>Last Update</B> " + day, month, daym;
if (dd == localTime)
{
dd = document.write("<b>Today</b>");
}
document.writeln("");
document.write(dd.substring(z, 0));
document.writeln("");
// Slutt -->
</SCRIPT>
Id be really grateful for any help.
Thanks a bunch in advance.
Is there some way of doing this? I been tring to fix it but Im just goin´ round in circles and its been ages since last programmed javascripts, theres probly some really easy solution to this but my brain has totally locked up so I would really need some advice and help with this.
Well heres the script as far as I managed:
<SCRIPT LANGUAGE="JavaScript">
<!-- Start
var mydate=new Date()
var dd = "<b>Last Update</B> " + document.lastModified;
var z = dd.length-8;
var day=mydate.getDay()
var month=mydate.getMonth()
var daym=mydate.getDate()
var localTime = "<b>Last Update</B> " + day, month, daym;
if (dd == localTime)
{
dd = document.write("<b>Today</b>");
}
document.writeln("");
document.write(dd.substring(z, 0));
document.writeln("");
// Slutt -->
</SCRIPT>
Id be really grateful for any help.
Thanks a bunch in advance.