title: Find day difference between two dates (excluding weekend days)
body: <p>Hi i am using jquery-ui datepicker to select date and <a href="http://mattkruse.com/javascript/date/date.js" rel="noreferrer">date.js</a> to find difference between 2 dates. </p>
  
  <p>Right now the problem is I want to exclude weekend days from calculation (saturday and sunday). How should i do that? </p>
  
  <p>For example the user select start date (13/8/2010) and end date (16/8/2010). Since 14/8/2010 and 15/8/2010 is in week days, instead of 4 days total, i want it to be only 2 days.</p>
  
  <p>This is the code im using right now:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  
      $("#startdate, #enddate").change(function() {       
  
      var d1 = $("#startdate").val();
      var d2 = $("#enddate").val();
  
              var minutes = 1000*60;
              var hours = minutes*60;
              var day = hours*24;
  
              var startdate1 = getDateFromFormat(d1, "d-m-y");
              var enddate1 = getDateFromFormat(d2, "d-m-y");
  
              var days = 1 + Math.round((enddate1 - startdate1)/day);             
  
      if(days&gt;0)
      { $("#noofdays").val(days);}
      else
      { $("#noofdays").val(0);}
  
  
      });
  
      &lt;/script&gt;
  </code></pre>