MSK7
01-02-2010, 02:27 PM
Hello all,
I am entering date from a calender in a textbox named "date" in the formate of (yyyy-mm-dd) like (2010-01-02).
I want to compare the entered date with todays current date ,
so that past date can not be submitted in the textbox.
i am using the code below to get todays current date to compare with text box value :-
var currentTime = new Date();
var Cmonth = currentTime.getMonth() + 1 ;
var Cday = currentTime.getDate();
var Cyear = currentTime.getFullYear();
var Today = (Cyear + "-" + Cmonth + "-" + Cday);
alert(Today);
But it gives todays date in the form of (2009-1-2)
rather than (2009-01-02).
please suggest me how this date can be achieved like (2009-01-02).
Please also suggest how the entered date can be compared with the achieved Todays current date ,
so that past date cannot be submitted.
Thanks & Regards.
I am entering date from a calender in a textbox named "date" in the formate of (yyyy-mm-dd) like (2010-01-02).
I want to compare the entered date with todays current date ,
so that past date can not be submitted in the textbox.
i am using the code below to get todays current date to compare with text box value :-
var currentTime = new Date();
var Cmonth = currentTime.getMonth() + 1 ;
var Cday = currentTime.getDate();
var Cyear = currentTime.getFullYear();
var Today = (Cyear + "-" + Cmonth + "-" + Cday);
alert(Today);
But it gives todays date in the form of (2009-1-2)
rather than (2009-01-02).
please suggest me how this date can be achieved like (2009-01-02).
Please also suggest how the entered date can be compared with the achieved Todays current date ,
so that past date cannot be submitted.
Thanks & Regards.