Re: Need quick JS help...

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

 Date:  Wed, 5 Jan 2000 19:04:50 -0000
 To:  <karen(at)magellan.edu>,
<hwg-techniques(at)hwg.org>
 References:  magellan
  todo: View Thread, Original
> My JS isn't up to speed yet but boss has insisted on having a date script
on our homepage. Now, the date displays correctly in IE but is at year 100
in Netscape and I don't have the skills (yet) to tell what to tweak.
>
> Could someone give our homepage a gander and let me know how to fix the
problem or perhaps, point me to a better script to use? Thank you very much
in advance!
>
> Homepage URL: http://magellan.edu
>
> Karen Ahrens

Hi Karen

Actually, in NS 4.7 the date is showing correctly as 2000 while IE 5.01
shows 3900. All you need to do is add one line of JavaScript. In the
function dateAsString() add the line as shown below (without the asterisk).

function dateAsString() {
        theDay   = rightNow.getDay();
        theMonth = rightNow.getMonth();
        theDate  = rightNow.getDate();
        theYear  = rightNow.getYear();

     * if (theYear > 1100) theYear = theYear - 1900;

This should then work in both browsers (and be safe until the Y3K bug <g>).

HTH

Brian
comharsa(at)clara.net

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