Deltaflyer
Programmer
Hiya everyone, is there a programmer in the house???
I am trying to create a web page that goes away and queries my database for entries between two dates. This is not a problem ( despite my having to use SQL7 ), the query works it returns all the values i want etc....etc....
My boss suddenly decides though, the people who are using my page are not as intelligent as i assumed, he reckons that they will put the startdate in the enddate box and vice versa, he has asked me to write a little java function that will check that this doesn't happen.
I though that the below coding would do the job, it doesn't.
Can anybody tell me why or show me the right way of comparing dates.
Thanks In Advance, Deltaflyer
P.S. checkdate(formobj.cdate ....etc....) is validating that the correct format has been observed, i.e. dd/mm/yy.
var cdate1 = formobj.cdate1.value
var cdate2 = formobj.cdate2.value
if (checkdate(formobj.cdate1.value) == 1)
{
alert("start date is invalid. \n format dd/mm/yy."
return
}
if (checkdate(formobj.cdate2.value) == 1)
{
alert("end date is invalid. \n format dd/mm/yy."
return
}
if (cdate1 < cdate2)
{
alert("start date after end date - Big Error - Stop It!!!"
return
}
formobj.submit() DeltaFlyer - The Only Programmer To Crash Land In Style.
I am trying to create a web page that goes away and queries my database for entries between two dates. This is not a problem ( despite my having to use SQL7 ), the query works it returns all the values i want etc....etc....
My boss suddenly decides though, the people who are using my page are not as intelligent as i assumed, he reckons that they will put the startdate in the enddate box and vice versa, he has asked me to write a little java function that will check that this doesn't happen.
I though that the below coding would do the job, it doesn't.
Can anybody tell me why or show me the right way of comparing dates.
Thanks In Advance, Deltaflyer
P.S. checkdate(formobj.cdate ....etc....) is validating that the correct format has been observed, i.e. dd/mm/yy.
var cdate1 = formobj.cdate1.value
var cdate2 = formobj.cdate2.value
if (checkdate(formobj.cdate1.value) == 1)
{
alert("start date is invalid. \n format dd/mm/yy."
return
}
if (checkdate(formobj.cdate2.value) == 1)
{
alert("end date is invalid. \n format dd/mm/yy."
return
}
if (cdate1 < cdate2)
{
alert("start date after end date - Big Error - Stop It!!!"
return
}
formobj.submit() DeltaFlyer - The Only Programmer To Crash Land In Style.