y2k in netscape 4.08

by Andrew Browne <abrowne(at)pbm.co.za>

 Date:  Tue, 4 Jan 2000 13:32:25 +0200
 To:  "'hwg-languages(at)mail.hwg.org'" <hwg-languages(at)mail.hwg.org>
  todo: View Thread, Original
In netscape 4.08 the following JavaScript occurs:

var today =3D new Date();=20
var myYear =3D today.getYear();
alert(myYear);
returns 100.

To show the current year I use:

var today =3D new Date();=20
var myYear =3D today.getYear();
myYear =3D myYear + 1900;
alert(myYear);
which returns 2000

However, in IE5:

var today =3D new Date();=20
var myYear =3D today.getYear();
alert(myYear);
returns 2000

Therefore, on my page I need to check for returned dates of less than =
2000 and add 1900 only to those.  Can anyone tell me why this =
discrepancy exists?

Cheers
Andrew

HWG: hwg-languages mailing list archives, maintained by Webmasters @ IWA

This page is part of a preserved archive of archives.hwg.org. The site is no longer active and its content is not maintained. For enquiries about this archive, write to archive(at)iwanet.org.