Hello,
I want to display a message like this:
Day x of construction.
To do this I want to have a function in a js file that takes two dates, calculates their difference and returns an integer value.
I have a file called functions.js which has a bunch of functions I'm using in my site. One of those functions is:
function daysDiff(begDate, endDate) {
alert("testmsg")
var diffMillSec = endDate.getTime() - begDate.getTime()
return Math.ceil(diffMillSec / oneDay()
}
My html looks like this:
<p>Day <script language="JavaScript">daysDiff(new Date(2005,9,31), new Date())</script> of construction</p>
When I run it nothing displays where I expect the numeric value.
What am I doing wrong?
Thanks in advance for any help.
David.
I want to display a message like this:
Day x of construction.
To do this I want to have a function in a js file that takes two dates, calculates their difference and returns an integer value.
I have a file called functions.js which has a bunch of functions I'm using in my site. One of those functions is:
function daysDiff(begDate, endDate) {
alert("testmsg")
var diffMillSec = endDate.getTime() - begDate.getTime()
return Math.ceil(diffMillSec / oneDay()
}
My html looks like this:
<p>Day <script language="JavaScript">daysDiff(new Date(2005,9,31), new Date())</script> of construction</p>
When I run it nothing displays where I expect the numeric value.
What am I doing wrong?
Thanks in advance for any help.
David.