SitePoint Sponsor

User Tag List

Results 1 to 7 of 7

Threaded View

  1. #1
    SitePoint Enthusiast snorky's Avatar
    Join Date
    Jul 2003
    Great Northwet
    0 Post(s)
    0 Thread(s)

    Solved: Date Display in IE vs FireFox

    The survey sez:

    It's a known, um, anomaly, in FireFox.

    Use function getFullYear() instead of getYear()

    That's all, folks!

    I have a simple piece of code that works as expected in IE6 and IE7. It displays strangely in FireFox 2x and Konqueror3.5

    The code:

    <script language="JavaScript" type="text/javascript">
    document.write(" OHSD 2002-" + cDate.getYear());

    In IE it displays correctly:

    OHSD 2002-2007

    In FireFox and Konqueror, it displays in a bizarre fashion:

    OHSD 2002-107

    Considering that FF and Konqueror tend to be more standards-compliant than IE, I suspect it's bad code. In any case, what would be better code, or a fix, or a work-around?
    Last edited by snorky; Oct 9, 2007 at 13:22. Reason: Problem Solved
    Bless the little children while they're still too young to hate.
    - Tom T. Hall


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts