Thursday, 27 June 2013

avascript function to validate date format dd/mm/yyyy

var chkdate = document.getElementById("date_slot").value
    if(document.getElementById("date_slot").value == "")
    {
        alert("Please enter the Date..!!")
        hh.date_slot.focus();
        return false;
    }
  else if(!chkdate.match(/^(0[1-9]|[12][0-9]|3[01])[\- \/.](?:(0[1-9]|1[012])[\- \/.](19|20)[0-9]{2})$/))
        {
          alert('date format is wrong');
          hh.date_slot.focus();
        return false;
        }

No comments:

Post a Comment