Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

date

Status
Not open for further replies.

novice2004

Programmer
Feb 2, 2004
62
US
I get two dates from text fields

"10/30/2004"
"11/25/2004"

How do I determine difference in days?
Thank you.
 
subtracting one Date object from another gives you the difference between the two in milliseconds.

this ought to do it:
Code:
var d1 = new Date("10/30/2004");
var d2 = new Date("11/25/2004");

var days = (d2 - d1) / 1000 / 60 / 60 / 24;

=========================================================
-jeff
try { succeed(); } catch(E) { tryAgain(); } finally { rtfm(); }
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top