473,407 Members | 2,314 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

Date.parse

Ben
Hi,

Can anyone explain why this,
Date.parse("Jan 1, 1970")
equals this,
18000000
?

Microsoft's documentation reports this, "
The parse method returns an integer value representing the number of
milliseconds between midnight, January 1, 1970 and the date supplied
in dateVal.
"

Would that not imply that the above value should be ZERO?

Thanks!

Jun 19 '07 #1
3 4273
"Ben" wrote:
Can anyone explain why this,
Date.parse("Jan 1, 1970")
equals this,
18000000
?
Your time zone accounts for the difference. Compare:

Date.parse("Jan 1, 1970 EST") // 18000000
Date.parse("Jan 1, 1970 GMT") // 0

--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms.

Jun 20 '07 #2
In microsoft.public.scripting.jscript message <1182292689.337148.23170@o
61g2000hsh.googlegroups.com>, Tue, 19 Jun 2007 15:38:09, Ben
<va******@gmail.composted:
>Can anyone explain why this,
Date.parse("Jan 1, 1970")
equals this,
18000000
?

Microsoft's documentation reports this, "
The parse method returns an integer value representing the number of
milliseconds between midnight, January 1, 1970 and the date supplied
in dateVal.
"

Would that not imply that the above value should be ZERO?
It would, but MS documentation should not be believed infallible.

You have 18000000 ms or 18000 sec or 300 min or 5 hours.

You, apparently being in New York or thereabouts, are five hours slow on
the real time, which is of course GMT.

Their "midnight, January 1, 1970" is ambiguous, because a day has two
midnights, and also wrong, because it implies local time.

The true zero is 1970-01-01 00:00:00 UT, to which UTC & GMT are good
approximations for the purpose.

Note - Microsoft probably copied the error, rather than originating it.

It's a good idea to read the newsgroup c.l.j and its FAQ. See below.

--
(c) John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v6.05 IE 6
news:comp.lang.javascript FAQ <URL:http://www.jibbering.com/faq/index.html>.
<URL:http://www.merlyn.demon.co.uk/js-index.htmjscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/TP/BP/Delphi/jscr/&c, FAQ items, links.
Jun 20 '07 #3
There he excels.

Like anybody who thinks Cristmas is the day
the sun shines 24 hours over the his square mile.

And the rest of the word of 6 Billion will suck up
to a militant and lying minority of ess than 100 million.
Year, right.

"Dave Anderson" <NP**********@spammotel.comwrote in message
news:13*************@corp.supernews.com...
"Ben" wrote:
>Can anyone explain why this,
Date.parse("Jan 1, 1970")
equals this,
18000000
?

Your time zone accounts for the difference. Compare:

Date.parse("Jan 1, 1970 EST") // 18000000
Date.parse("Jan 1, 1970 GMT") // 0

--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message.
Use of this email address implies consent to these terms.
Jul 7 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Gerrit Holl | last post by:
Posted with permission from the author. I have some comments on this PEP, see the (coming) followup to this message. PEP: 321 Title: Date/Time Parsing and Formatting Version: $Revision: 1.3 $...
4
by: Matteo | last post by:
Hy everybody. I'm not a html writer, but a sysadmin who's trying to help a user able to compile an online form with IE but not with Mozilla (Moz1.6, Ns7.1, Firefox 0.8+) due to a javascript date...
3
by: Jon Davis | last post by:
The date string: "Thu, 17 Jul 2003 12:35:18 PST" The problem: // this fails on PST DateTime myDate = DateTime.Parse("Thu, 17 Jul 2003 12:35:18 PST"); Help? Jon
14
by: Jon Davis | last post by:
I have put my users through so much crap with this bug it is an absolute shame. I have a product that reads/writes RSS 2.0 documents, among other things. The RSS 2.0 spec mandates an en-US style...
7
by: | last post by:
I am trying to validate a textfield to ensure it holds a time. I use a try/catch block to see if I can convert to a time & if it works then I blindly 'assume' it was OK. This single line Dim...
15
by: Khurram | last post by:
I have a problem while inserting time value in the datetime Field. I want to Insert only time value in this format (08:15:39) into the SQL Date time Field. I tried to many ways, I can extract...
28
by: romy | last post by:
What's the easiest way to verify the user had entered a valid date ?
26
by: jshanman | last post by:
I am writing a timeline that uses Google Maps. I have a function that converts a date time to latitude coords. This function is used to draw the markers on the timeline. I need a reverse function...
34
by: -Lost | last post by:
I'm REALLY liking this so far. And for those who welcome something a little less cryptic than what the resident date guru offers, here's a chance to try something fairly elegant and definitely...
11
by: Chris | last post by:
Hi, I'm kind of new to the more involved workings of javascript, and am having a few problems. My problem is this: I am working with a CMS which is including various javascrip files in the...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.