faqts : Computers : Programming : Languages : JavaScript

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

6 of 8 people (75%) answered Yes
Recently 6 of 8 people (75%) answered Yes

Entry

how to find the days between two dates

Apr 8th, 2008 19:01
ha mo, Dave Clark, nalini mano,


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Nalini,
     Note that you may see some discrepancy in these results when the 
date range spans a time change due to Daylight Saving Time.
var begDate = new Date("04/30/2007");
var endDate = new Date("05/31/2007");
var diff = endDate - begDate;
var oneDay = 24 * 60 * 60 * 1000;
alert('Days = ' + Math.round(diff/oneDay));
Take care,
Dave Clark
www.DaveClarkConsulting.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
http://www.businessian.com
http://www.computerstan.com
http://www.financestan.com
http://www.healthstan.com
http://www.internetstan.com
http://www.moneyenews.com
http://www.technologystan.com
http://www.zobab.com
http://www.healthinhealth.com