Date() bug in JavaScript


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Date() bug in JavaScript

  1. #1
    gek po Guest

    Date() bug in JavaScript


    Hi,

    I found out that some PC add 1 hour to the time for the below code.
    Please advise how to collect it.
    Thanks in advance!

    <script language=Javascript>
    var d;
    d = new Date();
    document.write("Local Time(JS): ");
    document.write(d);
    </script>

    Most of the PC will return:
    Local Time(JS): Fri Jun 28 18:29:46 UTC+0800 2002

    but some PC will return:
    Local Time(JS): Fri Jun 28 19:29:46 UTC+0800 2002

  2. #2
    Matthew Solnit Guest

    Re: Date() bug in JavaScript

    Daylight savings?

    "gek po" <webdev.@127.0.0.1> wrote in message news:3d1c39c1$1@10.1.10.29...
    >
    > Hi,
    >
    > I found out that some PC add 1 hour to the time for the below code.
    > Please advise how to collect it.
    > Thanks in advance!
    >
    > <script language=Javascript>
    > var d;
    > d = new Date();
    > document.write("Local Time(JS): ");
    > document.write(d);
    > </script>
    >
    > Most of the PC will return:
    > Local Time(JS): Fri Jun 28 18:29:46 UTC+0800 2002
    >
    > but some PC will return:
    > Local Time(JS): Fri Jun 28 19:29:46 UTC+0800 2002




  3. #3
    gek po Guest

    Re: Date() bug in JavaScript


    Not sure. I have checked all the PC Date/Time and Regional Option setting,
    but can't find where to set/correct the daylight savings.
    Please advise.
    Besides, may I know Javascript take the local time from which setting?
    Thanks in advance!

    "Matthew Solnit" <spam sucks!> wrote:
    >Daylight savings?
    >
    >"gek po" <webdev.@127.0.0.1> wrote in message news:3d1c39c1$1@10.1.10.29...
    >>
    >> Hi,
    >>
    >> I found out that some PC add 1 hour to the time for the below code.
    >> Please advise how to correct it.
    >> Thanks in advance!
    >>
    >> <script language=Javascript>
    >> var d;
    >> d = new Date();
    >> document.write("Local Time(JS): ");
    >> document.write(d);
    >> </script>
    >>
    >> Most of the PC will return:
    >> Local Time(JS): Fri Jun 28 18:29:46 UTC+0800 2002
    >>
    >> but some PC will return:
    >> Local Time(JS): Fri Jun 28 19:29:46 UTC+0800 2002

    >
    >



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center