Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Firefox new date(); fails. 1

Status
Not open for further replies.

styleBunny

Technical User
Jun 20, 2002
133
AU
Hi Guys, i am using this script to update the date at the bottom of my page for copyright. This works find in ie but the new date() function fails in Fire fox. Has anyone seen a way around this?

Cheers
Paul.

<script language="JavaScript">
//script to keep the copyright date current.
copyright=new Date();
update=copyright.getYear();
</script>

<div id="copyright">
<script language="JavaScript">
document.write("copyright © "+ update);
</script>
</div>
 
Clearly, FireFox keeps time starting at the year 1900. Assuming that browsers start from 1900 or 0, then add this line:

Code:
<script language="JavaScript">
//script to keep the copyright date current.
    copyright=new Date(); 
    update=copyright.getYear(); 
    [red]if (update<1900) update += 1900;[/red]
</script>

<div id="copyright">
<script language="JavaScript">
document.write("copyright © "+ update);
</script>
</div>

--Chessbot

"See the TURTLE of enormous girth!"
-- Stephen King, The Dark Tower series
 
Hi Chessbot,

Thanks for the help. The 1900 start date wasn't as obvious to me as it was to you. I have been too busy sorting css issues to think logically anymore. ;)

Thanks again,
Paul.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top