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(" ");
      }

Cheers!

1 comment:

  1. thanks for sharing the more valuable information.
    Indian Cyber Army credibility in Ethical hacking training & Cybercrime investigation training is acknowledged across nation as we offer hands on practical knowledge and full assistance with basic as well as advanced level ethical hacking & cybercrime investigation courses. The training is conducted by subject specialist corporate professionals with wide experience in managing real-time ethical hacking/ cyber security projects. Indian Cyber Army implements a blend of academic learning and practical sessions to give the candidate optimum exposure.

    ReplyDelete