title: Retrieving and Comparing Dates using JQuery And PHP
body: <p>I am using jQuery's datepicker in wordpress/PHP and I am using this code to show dates:    </p>
  
  <pre><code>&lt;script src="http://code.jquery.com/jquery-latest.js"&gt;&lt;/script&gt;
  &lt;script&gt;
      $(function() {
          $("#datepicker").datepicker();
          $("#datepicker").datepicker("option","dateFormat",'yy-mm-dd');
      });
  &lt;/script&gt;
  
  
   Date&lt;input type="text" id="datepicker" size="20" maxlength="15"  style="width: 80px;" readonly="readonly"/&gt;
  </code></pre>
  
  <p>It successfully displays my date.</p>
  
  <p>Also, I have a table (wp_redeem_vouchers) in the database that has specific voucher  redemption dates saved in it:</p>
  
  <pre class="lang-none prettyprint-override"><code>  id       wp_deal_id            redeem_date
    1      Amazon6767           2012-03-21
    2      Ebay87nm             2013-06-12
    3      M&amp;Svouc              2013-01-01
    4      ASDA                 2011-09-08       
  </code></pre>
  
  <p><strong>Question:</strong></p>
  
  <ol>
  <li><p>How can I retrieve "redeem_date" and compare with the datepicker's textbox date (upon selection) with the date already saved in the database?</p></li>
  <li><p>Is there anyway I could disable past date so that user can't choose the past date from date picker? i.e The user on 14/03/2013 can't choose 22/02/2013 from datepicker.</p></li>
  </ol>