Re: Adding "Last Update" notation to a page

by "Comharsa" <comharsa(at)clara.net>

 Date:  Mon, 3 Jan 2000 23:51:44 -0000
 To:  <hwg-basics(at)hwg.org>
 References:  oemcomputer gmx ptd
  todo: View Thread, Original
> > >     document.write(saveddate.getDate(),",
",(saveddate.getYear()+1900));
>
> Keep an eye on this one, check it with IE and NN.  I was using a very
> similar script if not the same one, and NN the date appeared at 2000 but
in
> IE is appeared at 3900.  I've temporarily replaced the getYear function
with
> 2000 until I can rewrite the script to compensate. :-)
>
> Deb

var today = new Date()
var year = today.getYear()
if (year > 1100) {year -= 1900}
document.write(today.getDate()+" "+(today.getMonth()+1)+" "+(year+1900));

This produces the correct date in both NS and IE (my versions at least). Why
did I choose year > 1100? So that there will be a Y3K problem for people to
sort out ;-).

Brian

HTML: hwg-basics mailing list archives, maintained by Webmasters @ IWA