473,761 Members | 2,293 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 4289
"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.publi c.scripting.jsc ript message <1182292689.337 148.23170@o
61g2000hsh.goog legroups.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.c om/faq/index.html>.
<URL:http://www.merlyn.demo n.co.uk/js-index.htmjscr maths, dates, sources.
<URL:http://www.merlyn.demo n.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**********@s pammotel.comwro te in message
news:13******** *****@corp.supe rnews.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
9444
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 $ Last-Modified: $Date: 2003/10/28 19:48:44 $ Author: A.M. Kuchling <amk@amk.ca> Status: Draft Type: Standards Track
4
43537
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 check. Let's go straight to the point: <script language="JavaScript"> alert("Date: "+Date.parse("2000-01-01"))
3
35097
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
3688
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 of date formatting (RFC 822). I have been using a variation of RFC 1123 (just change the time zone to an offset, i.e. "-0800"). It seems to be writing okay, but it's failing to parse. I've tried changing the regional & language settings in my...
7
2823
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 y As Date = CType("00:0z", Date) gives me a time of 1:00 am, whereas Dim z As Date = Date.Parse("00:0z")
15
18894
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 the value in timeonly format by using this command Format(now,"HH:mm:ss") But when I insert it into the Sql Server database, it embadded date value with it. the output looks like that "01/01/1900 08:59:00" in that case time is
28
2036
by: romy | last post by:
What's the easiest way to verify the user had entered a valid date ?
26
2726
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 to convert a latitude coord back to an accurate date time. Then I could detect the day/hour in the viewport when the timeline is zoomed in or out, or if it is moved. I cannot use the javascript date functions because this timeline will...
34
2529
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 unique. http://www.datejs.com/ -- -Lost Remove the extra words to reply by e-mail. Don't e-mail me. I am kidding. No I am not.
11
2722
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 pages, including files for a calendar (Dynarch). I would like to add some new functionality to the CMS and add some
0
9554
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9989
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9811
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8814
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7358
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6640
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5266
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5405
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3913
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.