Click to See Complete Forum and Search --> : Date.Parse
whisk
03-02-2003, 10:55 PM
Hi
Considering this:
Date.parse("3/28/2003 00:00:00") = 1048770000000
Date.parse("3/29/2003 00:00:00") = 1048856400000
Date.parse("3/30/2003 00:00:00") = 1048942800000
Date.parse("3/31/2003 00:00:00") = 1049032800000
Date.parse("4/1/2003 00:00:00") = 1049119200000
1049119200000 - 1049032800000 = 86400000
1049032800000 - 1048942800000 = 90000000 <- ??????
1048942800000 - 1048856400000 = 86400000
1048856400000 - 1048770000000 = 86400000
WHY???
khalidali63
03-03-2003, 12:17 AM
Can you be more descriptive...that is the correct result of the deduction...or you are referring to something else?
Khalid
whisk
03-03-2003, 12:26 AM
I'm wondering why between 3/30/2003 and 3/31/2003 there are 90000000 milliseconds when a normal day is 86400000 milliseconds.
khalidali63
03-03-2003, 12:42 AM
Hunm...here is what I used on Win2K SP2
<script type="text/javascript">
var d1 = Date.parse("3/28/2003 00:00:00")
var d2 = Date.parse("3/29/2003 00:00:00")
var d3 = Date.parse("3/30/2003 00:00:00")
var d4 = Date.parse("3/31/2003 00:00:00")
var d5 = Date.parse("4/1/2003 00:00:00")
document.write("d2-d1 ["+(d2-d1)+"]<br>d3-d2["+(d3-d2)+"]<br>d4-d3 ["+(d4-d3)+"<br>d5-d4["+(d5-d4)+"]")
</script>
The above gave me this out put
d2-d1 [86400000]
d3-d2[86400000]
d4-d3 [86400000
d5-d4[86400000]
Cheers
Khalid
whisk
03-03-2003, 12:48 AM
I just copied and pasted your code into a file and ran it in my browser via IIS 5.5 under XP
My results:
d2-d1 [86400000]
d3-d2[86400000]
d4-d3 [90000000
d5-d4[86400000]
woohooo freaky :D I'm wondering what xp has to do with anything.. or even if it is xp.. ?????????????????????????
EDIT: XP SP1
EDIT2: What browser are you using??
khalidali63
03-03-2003, 12:51 AM
lol..good luck with XP
I am sure it has to do with that.
cus I have win2k pro sp2
and tested the solution on IE6/NS6+
browsers..
interesting
Khalid
khalidali63
03-03-2003, 12:53 AM
Complete code that is in question
<script type="text/javascript">
var d1 = Date.parse("3/28/2003 00:00:00")
var d2 = Date.parse("3/29/2003 00:00:00")
var d3 = Date.parse("3/30/2003 00:00:00")
var d4 = Date.parse("3/31/2003 00:00:00")
var d5 = Date.parse("4/1/2003 00:00:00")
document.write("d2-d1 ["+(d2-d1)+"]<br>d3-d2 ["+(d3-d2)+"]<br>d4-d3 ["+(d4-d3)+"]<br>d5-d4 ["+(d5-d4)+"]")
</script>
Khalid
whisk
03-03-2003, 01:03 AM
I'm on IE6 too
d2-d1 [86400000]
d3-d2[86400000]
d4-d3 [90000000
d5-d4[86400000]
used the same code ay ? :D
so what do we do about this ?.. who do we tell ?
EDIT : still should make sure its an xp issue.. going to get someone with xp to look at your link.
whisk
03-03-2003, 01:08 AM
I just got someone to test it out.. he is using XP SP1 and gets the right results.
what else could it be ? ? ?
khalidali63
03-03-2003, 01:20 AM
Here is a revelation.."Your computer has a y2k bug"...lol
or just scrap all the code in the page you have ,actually just write upa new page with that code and see what that does..may..just may be the editor you are using it could have some hiddent character somewhere on the page screwing it up(it has happend to me)
Khalid
whisk
03-03-2003, 01:24 AM
I've had that happen to me before.. an editor adding hidden characters that trashed code.. but its not that since I get the same results viewing you page in my browser.
Thanks for all you help.
khalidali63
03-03-2003, 01:27 AM
bill your time to Bill gates and company..lol
Cheers
Khalid
Just a note: This is what Khalid's page returns for me in IE6 on Win XP...
d2-d1 [86400000]
d3-d2 [86400000]
d4-d3 [86400000]
d5-d4 [86400000]
khalidali63
03-03-2003, 08:07 AM
Thats freaky,I do not want to say that its his sys or the OS but it is most certainly something on his Box that is screwing up the dates..
a screwd up clock speed on the motherboard...I hope its not far fetched?? what you think pyro?
Khalid
Originally posted by khalidali63
what you think pyro?To be honest, I'm not sure what to think... It is obviously some sort of problem on whisk's end, as it works for you and for me... I'd think that somehow his system clock is messed up, as that is where javascript would be taking the time from... weird...
Just to liven things up a bit. I'm using Win XP Pro SP1 and I get this:
d2-d1 [86400000]
d3-d2 [86400000]
d4-d3 [82800000]
d5-d4 [86400000]
Even more freaky!
IxxI
EDIT: Using IE 6 too.
whisk
03-03-2003, 11:42 AM
Originally posted by pyro
To be honest, I'm not sure what to think... It is obviously some sort of problem on whisk's end, as it works for you and for me... I'd think that somehow his system clock is messed up, as that is where javascript would be taking the time from... weird...
I don't know a great deal about hardware but is there anyway I can fix my system clock.. like reset it or run some software to fix things up.. should I be complaining to the guy I bought my motherboard from.. its not even that old, about 1 year old.
Could over clocking be responsible ?.. I remember overclocking a while back but not sure if I reset the speed... going to check when I restart my machine.
khalidali63
03-03-2003, 01:39 PM
I am not sure if this could have problem with overclocking,but if you could perform overclocking,you should be able to manage your harware farly easily.
I could be wrong....:D
Khalid
whisk
03-03-2003, 02:05 PM
Originally posted by khalidali63
I am not sure if this could have problem with overclocking,but if you could perform overclocking,you should be able to manage your harware farly easily.
I could be wrong....:D
Khalid
haha :) you'd think..
the overclocking I did was via a guide I found online that fits my cpu and board.. I just followed the steps.
I did check the bios and I had reset the cpu and board speed... so my pc is not overclocked anymore.
I was also removing some software when I noticed that I have XP SP2 installed, a number of them.. I run updates regularly.. just never take notice of what they are :) I follow the stupid rule that if its an update it must be good.
I'm wondering if pyro has SP2 installed too.. pyro ?
I'm running XP Home, with neither Service Pack installed.
whisk
03-03-2003, 02:33 PM
Originally posted by IxxI
Just to liven things up a bit. I'm using Win XP Pro SP1 and I get this:
d2-d1 [86400000]
d3-d2 [86400000]
d4-d3 [82800000]
d5-d4 [86400000]
Even more freaky!
IxxI
EDIT: Using IE 6 too.
oh!!! I didnt notice this post earlier...
well.. that is very interesting.. so with SP1 we get the 82800000 anomali and with SP2 we get the 90000000 anomali.. wonder whats install for us with SP3 :D
gil davis
03-03-2003, 02:33 PM
This acts like a Daylight Savings Time rule. I just put in for days around April 6 (when we leap forward here in Eastern Standard Time) and you lose a day.
<script type="text/javascript">
var d1 = Date.parse("4/3/2003 00:00:00")
var d2 = Date.parse("4/4/2003 00:00:00")
var d3 = Date.parse("4/5/2003 00:00:00")
var d4 = Date.parse("4/6/2003 00:00:00")
var d5 = Date.parse("4/7/2003 00:00:00")
document.write("d2-d1 ["+(d2-d1)+"]<br>d3-d2["+(d3-d2)+"]<br>d4-d3 ["+(d4-d3)+"]<br>d5-d4["+(d5-d4)+"]");
</script>
d2-d1 [86400000]
d3-d2[86400000]
d4-d3 [86400000]
d5-d4[82800000]
khalidali63
03-03-2003, 02:45 PM
Lets see who volunteers to instal XP SP2
and confirms that if this problem is os not specific to whisks machine only.
I'd have done that but I have win2k pro
Khalid
Well, I'd like to volunteer, but won't for two reasons:
1. I could not find a SP2 for Win XP Home. The closest I could find was SP1a
2. SP1a comes with the SP1 for IE, which has crashed my computer twice. I'm not eager to let it happen again. :p
whisk
03-03-2003, 03:08 PM
Originally posted by gil davis
This acts like a Daylight Savings Time rule. I just put in for days around April 6 (when we leap forward here in Eastern Standard Time) and you lose a day.
<script type="text/javascript">
var d1 = Date.parse("4/3/2003 00:00:00")
var d2 = Date.parse("4/4/2003 00:00:00")
var d3 = Date.parse("4/5/2003 00:00:00")
var d4 = Date.parse("4/6/2003 00:00:00")
var d5 = Date.parse("4/7/2003 00:00:00")
document.write("d2-d1 ["+(d2-d1)+"]<br>d3-d2["+(d3-d2)+"]<br>d4-d3 ["+(d4-d3)+"]<br>d5-d4["+(d5-d4)+"]");
</script>
oh.. ok.. so the 3600000 difference is the hour lost or gained, depending on daylight saving time.
thanks.. problem solved :D
khalidali63
03-03-2003, 03:17 PM
I think I am lost now..
:D
The initial error you got was on the dates around 30 march....
how could your system be adding an hour around those dates( since its the system that takes care of DLS time(.
I hope I haven't been staring the monitor fo way toooo long..
lol
Khalid
whisk
03-03-2003, 03:30 PM
Originally posted by khalidali63
I think I am lost now..
:D
The initial error you got was on the dates around 30 march....
how could your system be adding an hour around those dates( since its the system that takes care of DLS time(.
I hope I haven't been staring the monitor fo way toooo long..
lol
Khalid
without a doubt I stare at the monitor way to long :D
The DST here in Melbourne Australia is:
DST ends on Sunday, March 30, 2003, at 3:00:00 AM local daylight time
DST starts on Sunday, October 26, 2003, at 2:00:00 AM local standard time
so on 3/30/2003 the time goes from 3am to 2am which gives an extra hour to the hours betweem 3/30/2003 and 3/31/2003.
I don't know what controls what but it sure does make sense.
I'm just a little embarrased that I didnt think of that.
gil davis
03-03-2003, 03:32 PM
I think I am lost now..Maybe his environment is set wrong - either the date pattern or the time zone, or both. Add to that, he's in Australia, and I don't know what the time zone rules are down under. It just seemed like that was what his machine was trying to tell him.
It would be interesting to add this to the end of the script:
document.write(new Date(d1)+"<br>"+new Date(d2)+"<br>"+new Date(d3)+"<br>"+new Date(d4)+"<br>"+new Date(d5));
and see if the dates look right.
I wrote this before I saw whisk's latest response. Woo Hoo! ;-)
khalidali63
03-03-2003, 03:34 PM
And now I am embarrased that I did not look at the left of the screen under your SN that you wre in melbourne...grrrr
Hey by the way you guys are kickin as**** in world cricket cup ..
Khalid
whisk
03-03-2003, 03:38 PM
Originally posted by khalidali63
Hey by the way you guys are kickin as**** in world cricket cup ..
Khalid [/B]
yeah, we usually do :D not that I follow the cricket... even with shane warne being banned for the 6 months or whatever it is, we will probably still win... got to be good at something :)
khalidali63
03-03-2003, 03:41 PM
lol..
funny that shane warne said ..
"no it wasn't dope,it was the mdecine that his mom gave it to him"..
cmon silly..make a better excuse
:D
Anyways...
Cheers
Khalid
None of this explains why mine is wrong too. :(
Unless I missed something obvious (very possible).
IxxI
whisk
03-04-2003, 04:13 AM
These are the DST settings for London UK
DST starts on Sunday, March 30, 2003, at 1:00:00 AM local standard time
DST ends on Sunday, October 26, 2003, at 2:00:00 AM local daylight time
we end DST on 3/30/2003 so gain an extra 1hr (+3600000)
so for me a normal day which is 86400000
+ the extra 1hr (+3600000) = 90000000 <- which is what we get here for the date difference between 3/30/2003 & 3/31/2003
you guys start DST on 3/30/2003 so you loose an 1hr (-3600000)
so for you a normal day which is 86400000
- the 1hr lose (-3600000) = 82800000 <- which is what you get for the date difference between 3/30/2003 & 3/31/2003
Magic - it all makes sense now. And to think we could have uncovered a microsoft plot. :D
Thanks Whisk,
IxxI
whisk
03-04-2003, 06:06 AM
Yeah :D I thought I stumbled on some microsoft blunder that they were trying to cover up with service patches LOL
and all your thanks should go to gil davis.