I am trying to pass the dates from my form fields, but I haven't been able to get it to work.
function DateDiffInDays(sDate1, sDate2)
{
var asdf
var dtDate1 = Date.parse(sDate1);
var dtDate2 = Date.parse(sDate2);
return asdf=(dtDate2 - dtDate1) / (24 * 60 * 60 * 1000);
if (asdf<14) {
alert("asdf")}
else {
alert("try again")
}
}
<input type="text" name="dateRequired" value=<%=(DateAdd("d",14,d
Can you help me figure out where I'm going wrong??
Thanks!
Main Topics
Browse All Topics





by: amit_gPosted on 2006-03-02 at 13:08:58ID: 16088850
You need a client side function take
icles/2006 /01/10/jav ascript-co de- dateadd -code-and- code-dated iff-code
http://www.fleegix.org/art
That is quite good but is more involved. If you need something simpler you could use
<SCRIPT LANGUAGE=javascript>
function DateDiffInDays(sDate1, sDate2)
{
var dtDate1 = Date.parse(sDate1);
var dtDate2 = Date.parse(sDate2);
return (dtDate2 - dtDate1) / (24 * 60 * 60 * 1000);
}
</SCRIPT>
make sure to pass correct date to it.