Gary Williams
03-25-2003, 09:47 AM
Hi All,
The following script tests 2 dates. If 'today' is earlier than 'coverdate', all is fine. If 'today' is later than 'coverdate', the alert correctly displays.
Here's the problem. If 'today' and 'coverdate' are the same (which is OK), the alert displays because 'today', taken from the system clock, assumes midnight as the starting point (therefore 10am is 'later'). How can I get the script to work with just the date and ignore the time of day?
Regards
Gary
===================
today = new Date();
coverdate = new Date(frmquotation.testcoverdate.value);
gettoday = today.getTime();
getcoverdate = coverdate.getTime();
datetest = gettoday - getcoverdate
if(datetest > 0){
alert("Please choose a cover date from tomorrow onwards.");
frmquotation.cbocoverdateday.focus();
return false;
}
===================
ps. Thanks Justame for the script.
The following script tests 2 dates. If 'today' is earlier than 'coverdate', all is fine. If 'today' is later than 'coverdate', the alert correctly displays.
Here's the problem. If 'today' and 'coverdate' are the same (which is OK), the alert displays because 'today', taken from the system clock, assumes midnight as the starting point (therefore 10am is 'later'). How can I get the script to work with just the date and ignore the time of day?
Regards
Gary
===================
today = new Date();
coverdate = new Date(frmquotation.testcoverdate.value);
gettoday = today.getTime();
getcoverdate = coverdate.getTime();
datetest = gettoday - getcoverdate
if(datetest > 0){
alert("Please choose a cover date from tomorrow onwards.");
frmquotation.cbocoverdateday.focus();
return false;
}
===================
ps. Thanks Justame for the script.