Tuesday, October 30, 2012

JavaScript - Current Date less than Chosen Date


Example:


 var dateField = document.getElementById("txtAppDate").value;
           dateField=dateField.replace("-","/");
              var d=dateField.replace("-","/");        
            var stDate = new Date();
            var enDate = new Date(Date.parse(d));
            var compDate = enDate - stDate;



if(compDate<=0)
                {
                    alert('the entered appointment Date should be greater than todays date');
                    return false;
                }

No comments:

Post a Comment