Tuesday, 7 February 2012

How to check two dates in javascript?

Hi Folks,

      /* Getting current year */
    var current_date = new Date();
      /* Converting user input date of birth to javascript data format... */
      var date_of_birth = new Date($('#order_date_of_birth_year').val(),$('#order_date_of_birth_month').val()-1,$('#order_date_of_birth_day').val());
      if(date_of_birth.getTime()>current_date.getTime()) {
        $('#date_of_birth_error').html("Date of Birth cannot be a future date");
        err = err+1;
        return false;
      }else {
          $('#date_of_birth_error').html(" ");


No comments:

Post a Comment