Can someone tell me how to compare a date from a form to the current system date. I've tried coding this several ways and keep getting errors.
What I have is a form with 3 drop down boxes to determine a date. Dropdown boxes for Day is 01-31, Month is "January - December" and Year is 2000-2002. I validate the month and the day combindation and then string the 3 fields together to get the date entered - it's in the following format eg: "August 14, 2001"
here is the code:
datein = frmMonth+" "+frmDay+", "+frmYear // fields from form
today = new Date();
if (expiry.getTime() > today.getTime()) {
alert("This expiry date can not be greater than current date." document.frmAddCourse.Day.focus();
return (false);
}
This code works fine if current date is anything other than = to expiry date. If the two dates are equal if falls into the error logic.
Thanks
Tterrapin
What I have is a form with 3 drop down boxes to determine a date. Dropdown boxes for Day is 01-31, Month is "January - December" and Year is 2000-2002. I validate the month and the day combindation and then string the 3 fields together to get the date entered - it's in the following format eg: "August 14, 2001"
here is the code:
datein = frmMonth+" "+frmDay+", "+frmYear // fields from form
today = new Date();
if (expiry.getTime() > today.getTime()) {
alert("This expiry date can not be greater than current date." document.frmAddCourse.Day.focus();
return (false);
}
This code works fine if current date is anything other than = to expiry date. If the two dates are equal if falls into the error logic.
Thanks
Tterrapin