title: how to get difference in year where dates are in yyyy-mm-dd?
body: <p>i want to get the difference between two dates which are give in yyyy-mm-dd format difference should be in year.        </p>
  
  <pre><code>        var ds='2002-09-23';
          var today_date = new Date();
          alert(today_date);
          Date.prototype.yyyymmdd = function() {
          var mm = (this.getMonth()+1).toString(); // getMonth() is zero-based
          var dd  = this.getDate().toString();
          var dt = yyyy +"-"+(mm[1]?mm:"0"+mm[0]) +"-"+ (dd[1]?dd:"0"+dd[0]);// padding
          var num_years = diff_date/31536000000;
          alert(num_years);
          if (num_years&gt;18){
             alert (num_years);
          }else{
          alert ("i m not 18");
                 }
  </code></pre>
  
  <p>please help me out.</p>