title: How do I get the date from a datepicker using PHP?
body: <p>How do I get the date from a jquery UI datepicker like the month and save the value of it in a variable in php? </p>
  
  <p>I've seen a lot of things like this <code>&lt;div id="calendar"&gt;&lt;/div&gt;</code> and I don't understand.</p>
  
  <p>Thanks.</p>
  
  <p>Here's my code</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="false" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;html lang="en"&gt;
  &lt;head&gt;
  &lt;meta charset="utf-8"&gt;
  &lt;title&gt;jQuery UI Datepicker - Select a Date Range&lt;/title&gt;
  &lt;link rel="stylesheet" href="//code.jquery.com/ui/1.11.2/themes/smoothness/jquery-ui.css"&gt;
  &lt;script src="//code.jquery.com/jquery-1.10.2.js"&gt;&lt;/script&gt;
  &lt;script src="//code.jquery.com/ui/1.11.2/jquery-ui.js"&gt;&lt;/script&gt;
  &lt;link rel="stylesheet" href="/resources/demos/style.css"&gt;
  &lt;script&gt;
  $(function() {
  $( "#from" ).datepicker({
  defaultDate: "+1w",
  changeMonth: true,
  numberOfMonths: 1,
  onClose: function( selectedDate ) {
  $( "#to" ).datepicker( "option", "minDate", selectedDate );
  var day1 = $(this).datepicker('getDate').getDate();  
  var month1 = $(this).datepicker('getDate').getMonth();  
  var year1 = $(this).datepicker('getDate').getYear();
  }
  });
  $( "#to" ).datepicker({
  defaultDate: "+1w",
  changeMonth: true,
  numberOfMonths: 1,
  onClose: function( selectedDate ) {
  $( "#from" ).datepicker( "option", "maxDate", selectedDate );
  var day2 = $(this).datepicker('getDate').getDate();  
  var month2 = $(this).datepicker('getDate').getMonth();  
  var year2 = $(this).datepicker('getDate').getYear();
  }
  });
  });
  &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;label for="from"&gt; FROM &lt;/label&gt;
  &lt;input type="text" id="from" name="from"&gt;
  &lt;label for="to"&gt; TO &lt;/label&gt;
  &lt;input type="text" name="username" id="to" name="to"&gt;
  &lt;input type="submit" name="boton" value="  Submit "&gt;
  &lt;/body&gt;
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>