Hi,
I really don't know JavaScript but I have something to do with JavaScript.
I need to compare to dates that comes form form. I'll try to explain what I trying to do. They’re to Text boxes that hold the date in the form in the format of DD/MM/YYYY. I know that using the date() object requires to enter the date in (MM,DD,YYYY) format, so I splited the date on "/" and entered the date in the right order.
The problem is that I simply doesn't work
Why???
This is the code:
var fromdate = form2.date1.value
var todate = form2.date2.value
splitfromdate = fromdate.split("/"
;
splittodate = fromdate.split("/"
;
confromdate = new Date(splitfromdate[2].substr(2,2) , splitfromdate[1] , splitfromdate[0])
contodate = new Date(splittodate[2].substr(2,2) + "," + splittodate[1] + "," + splittodate[0])
if (confromdate >= contodate) {
alert ("'To' Date must be grater then 'From' Date"
;
return false;
}
I really don't know JavaScript but I have something to do with JavaScript.
I need to compare to dates that comes form form. I'll try to explain what I trying to do. They’re to Text boxes that hold the date in the form in the format of DD/MM/YYYY. I know that using the date() object requires to enter the date in (MM,DD,YYYY) format, so I splited the date on "/" and entered the date in the right order.
The problem is that I simply doesn't work
Why???
This is the code:
var fromdate = form2.date1.value
var todate = form2.date2.value
splitfromdate = fromdate.split("/"
splittodate = fromdate.split("/"
confromdate = new Date(splitfromdate[2].substr(2,2) , splitfromdate[1] , splitfromdate[0])
contodate = new Date(splittodate[2].substr(2,2) + "," + splittodate[1] + "," + splittodate[0])
if (confromdate >= contodate) {
alert ("'To' Date must be grater then 'From' Date"
return false;
}