Wrox Programmer Forums
|
Javascript General Javascript discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 13th, 2005, 12:26 PM
Registered User
 
Join Date: Apr 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Date.getMilliseconds()

When creating a Date object, you can pass the number of milliseconds since 1-1-1970. How would one ever compute such a figure?

What I want to do is compute elapsed days between two dates. If I had relative milliseconds, I could do that. Is there another way to do that?

I mistakenly assumed the setMilliseconds() and getMilliseconds() functions dealt with the 1-1-70 relative milliseconds value. But I now know they are associated with the time value of the Date object.

Is there a way to access the 1-1-70 relative milliseconds of a Date object?

Thanks,
Ken
 
Old April 14th, 2005, 03:03 PM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Use the valueOf property of the Date.

--

Joe (Microsoft MVP - XML)
 
Old May 3rd, 2005, 07:38 PM
nzakas's Avatar
Wrox Author
 
Join Date: Dec 2004
Posts: 217
Thanks: 0
Thanked 5 Times in 5 Posts
Default

The correct way to do this is to use getTime(), which returns the number of milliseconds since January 1, 1970 at midnight.

Nicholas C. Zakas
Author, Professional JavaScript for Web Developers (ISBN 0764579088)
http://www.nczonline.net/





Similar Threads
Thread Thread Starter Forum Replies Last Post
Show Images from Start Date thru Date istcomnet Classic ASP Basics 2 May 23rd, 2008 07:12 AM
copy date values between date controls Alcapone Javascript How-To 1 April 13th, 2006 03:13 AM
Date based query when date is nvarchar MichaelTJ SQL Language 4 January 12th, 2004 09:57 PM
DTS Import ( Date string to Date field) gfowajuh SQL Server 2000 1 September 30th, 2003 06:28 AM
Convert String Date to Date for a SQL Query tdaustin Classic ASP Basics 4 July 7th, 2003 06:01 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.