|JS ERROR with Windows 7 - 64bits|
The code is fine but doesn't work with Win7 - 64bits.
| 9:07 pm on Oct 11, 2011 (gmt 0)|
Hi, suddenly one of my scripts began trowing errors but the code is fine. I checked and somehow getting the date object and data doesn't work with ANY of my browser under WIN7 64. Opera, IE, FF, Safari... none.
I checked the w3schools example and the one with milliseconds gets 0 as a result. Any ideas on how to get around this?
I tested my app under every browser on Windows and several browsers under Ubuntu Linux, no problem, only with Windows7 64 bits.... weird...
| 9:11 pm on Oct 11, 2011 (gmt 0)|
Forgot to add: I searched the web but I don't seem to find others with the problem. Could it be anything else that only applies to me in this case? double checked, no idea.
| 10:23 pm on Oct 11, 2011 (gmt 0)|
For get what I wrote, the code is fine, but the short way is not working, the long way it is (win7 x64), on the rest of systems doesn't need modifications. Not solved but... solved!
| 10:50 pm on Oct 11, 2011 (gmt 0)|
Just to clarify, are using saying the following returns 0 under Win7 64bit?
var d = new Date();
...and the long way uses getTime()?
| 11:21 pm on Oct 11, 2011 (gmt 0)|
|Just to clarify, are using saying the following returns 0 under Win7 64bit? |
The following page "try it" gives me 0 every time, unless that's what is supposed to result... </clueless>
The code has been working fine with every browser, but now at work have a new machine with Win7 x64, and this is the first time I'm getting this error.
In the function I was generating a 13 digit number using the hour, minutes, seconds, etc using one line ++++, now I used one var for each part of the long digit and then joined them, now it works. Very strange. Sorry for the confusion.
| 12:58 am on Oct 12, 2011 (gmt 0)|
|The following page "try it" gives me 0 every time, unless that's what is supposed to result... |
Yes, that is the expected result in that particular example since the time portion of the string does not specify the number of milliseconds. It returns 0 in the same way that getSeconds() also returns 0.
However, my code example above (which is actually Example#1 from the w3schools page you link to) should give a result in the range 0-999. The w3schools example on that page is a live example, so refreshing the page a few times should give different results.
I don't have access to Win7 64bit, but I would guess it was something else that is breaking!? :) With a 64bit OS it is quite possible you could get different results from floating-point arithmetic expressions due to the increased precision - although I'm not sure how that would come into play here.
I would be interested to see the code which you say isn't working.
Btw, getTime() returns the internal representation of the Date object in milliseconds, which is currently a 13 digit number.
| 2:14 pm on Oct 12, 2011 (gmt 0)|
Thanks penders for the correction.
|I would be interested to see the code which you say isn't working. |
I was getting the numbers and adding them one to another in one line, it was working, but suddenly instead of forming a long string they began to sum into one number (as numbers not as strings). I thought about the milliseconds becase when I started removing parts of the line, removing that one seemed to work. The code was fixed, since I removed that part in the first place I'm not sure anymore, perhaps it was something that was modified along the way on my multireplacements (working with several scripts at once on my editor).
Thanks, I was worried about it.
| 7:08 pm on Oct 12, 2011 (gmt 0)|
|I was getting the numbers and adding them one to another in one line, it was working, but suddenly instead of forming a long string they began to sum into one number (as numbers not as strings). |
However, why this should behave differently on Win7 64bit is still a bit of a mystery, other than the fact that a 64bit OS will have a far greater numeric range before the numbers overflow. On a 32bit OS the numbers might result in overflow and so JS resorts to string concatenation - but that is a wild guess!