SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Thread: Wrong date

  1. #1
    SitePoint Enthusiast
    Join Date
    Mar 2006
    Posts
    38
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Wrong date

    Hello, I am using Ubuntu 8.04 & FF 3.0.1 and JavaScript is not returning the right date. I am getting GMT+1930; but it should be GMT-0430 (Venezuela), as it is what I am getting from the OS command line:

    TODAY IS: 12 of August of 2008, but

    var fecha=new Date();
    document.writeln(fecha.toDateString()); // Wed Aug 13 2008
    document.writeln(fecha.toLocaleDateString()); // 13/08/2008
    document.writeln(fecha.toLocaleString()); // miť 13 ago 2008 19:15:14 VET
    document.writeln(fecha.toLocaleTimeString()); // 19:15:14: this is OK
    document.writeln(fecha.toString()); // Wed Aug 13 2008 19:15:14 GMT+1930 (VET): It should be GMT-0430
    document.writeln(fecha.toTimeString()); // 19:15:14 GMT+1930 (VET): The time is OK, but GMT+1930

    NOTE: It is OK in FF & IE in WXP.

    Can anybody give a help?

  2. #2
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,179
    Mentioned
    191 Post(s)
    Tagged
    2 Thread(s)
    The javascript Date() comes from your OS (whether it's right or wrong).
    So I don't think it's a javascript problem, but rather a setting in the OS. If it's OK when it comes from your WinXP, but not from your Ubuntu, then you should look there. Sorry, but I'm unfamilliar with Ubuntu. Since the time is right, -430 and +1930 give the same time, just a day off, take a look at the GMT +/- settings, if you can.

  3. #3
    SitePoint Enthusiast
    Join Date
    Mar 2006
    Posts
    38
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thatś the problem because when I executed 'date -R' on the command line at Ubuntu, I got:

    Thu, 14 Aug 2008 23:27:27 -0430

    There, we can see -0430 and the right date.

  4. #4
    SitePoint Wizard bronze trophy
    Join Date
    Jul 2008
    Posts
    5,757
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    My guess is the os or ff has some type of setting for multiple timezones.
    It's also pretty possible the young ff3 for ubuntu has a bug.


Tags for this Thread

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
  •