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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Finding the difference between 2 dates

Status
Not open for further replies.

wuzzle

Programmer
Dec 20, 2000
75
CA
Can someone tell me if I'm interpreting this properly?
I know that it is finding the current time (nowsec), then setting a date in the future (doomsday). Is it then finding the proper format for the future date (thensec), and then subtracting the future date from the present to find out the difference?
What is /1000 /60 /60 /24 doing?

Thanks!

function duedate(now){
var nowsec = now.getTime();
var doomsday=new Date(2000, 00, 01, 00, 00, 00);
var thensec = doomsday.getTime();
var ans = (thensec - nowsec) /1000 /60 /60 /24;
document.doom.daystill.value=ans;
}
 
the divisions look like they are turning milliseconds into days. adam@aauser.com
 
so you'd better use GetDay() function !
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top