SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Zealot ChestRockwell's Avatar
    Join Date
    Nov 2003
    Location
    New Jersey
    Posts
    195
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Its the year 106!

    This is something pretty strange. I had to write a simple date function to output today's date and time. Well, in FireFox on my linux box and FF on Windows the year outputs as 106. In IE it prints out 2006. Here is the code:
    Code:
     function lastUpdate() {
       var lastupdated = new Date();
       var year = lastupdated.getYear();
       var month = lastupdated.getMonth();
       var day = lastupdated.getDate();
      
       var hours = lastupdated.getHours();
       var minutes = lastupdated.getMinutes();
       var seconds = lastupdated.getSeconds();
     
       return "Last Updated: "+year+"-"+month+"-"+day+"@"+hours+":"+minutes+":"+seconds;
     }
    I dont get any JS errors (I use firebug to check) any ideas what is going on here. I thought it may have been an error on my computer, but I saw the same issue on someone elses computer. Thanks!
    -- Joe C --
    "Do or do not. There is no try..."
    - Yoda

  2. #2
    He's No Good To Me Dead silver trophybronze trophy stymiee's Avatar
    Join Date
    Feb 2003
    Location
    Slave I
    Posts
    23,426
    Mentioned
    2 Post(s)
    Tagged
    1 Thread(s)
    var year = lastupdated.getFullYear();

    getYear() is deprecated for obvious reasons.

  3. #3
    SitePoint Zealot ChestRockwell's Avatar
    Join Date
    Nov 2003
    Location
    New Jersey
    Posts
    195
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    deprecated because it isnt the year 106 anymore?
    -- Joe C --
    "Do or do not. There is no try..."
    - Yoda

  4. #4
    He's No Good To Me Dead silver trophybronze trophy stymiee's Avatar
    Join Date
    Feb 2003
    Location
    Slave I
    Posts
    23,426
    Mentioned
    2 Post(s)
    Tagged
    1 Thread(s)
    deprecated because it isn't y2k compliant

  5. #5
    SitePoint Zealot ChestRockwell's Avatar
    Join Date
    Nov 2003
    Location
    New Jersey
    Posts
    195
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    sweet. thanks stymiee!
    -- Joe C --
    "Do or do not. There is no try..."
    - Yoda


Bookmarks

Posting Permissions

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