Note that there are some explanatory texts on larger screens.

plurals
  1. POjQuery formatting a date range
    primarykey
    data
    text
    <p>I have a page that allows the user to select a date range and then creates a pdf report from a database having the date between the range selected. This was working fine until I realized I cannot use the <code>html</code> <code>input</code> type <code>date</code>. Only certain browsers support it. So I am using this jQuery: <a href="http://jqueryui.com/datepicker/#date-range" rel="nofollow">http://jqueryui.com/datepicker/#date-range</a> However, now the date format is all wrong. MySQL takes a date format of <code>yyyy-mm-dd</code> and this is sending it in as <code>mm/dd/yyyy</code>. I have tried changing the format like so and nothing changes. Any ideas?</p> <pre><code> &lt;body&gt; &lt;div class="dateselectwrap"&gt; &lt;form action="reports/arrivals.php" method="post"&gt; &lt;div class="dateselect"&gt; &lt;input type="text" class="datepicker" name="start" id="from" required="yes" /&gt; &lt;input type="text" class="datepicker" name="finish" id="to" required="yes" /&gt; &lt;p &gt;Format options:&lt;br /&gt; &lt;select id="format"&gt; &lt;option value="yy-mm-dd"&gt;ISO 8601 - yy-mm-dd&lt;/option&gt; &lt;/select&gt; &lt;/p&gt; &lt;/div&gt; &lt;div class="datesubmit"&gt; &lt;input type="Submit" name="Submit"&gt; &lt;/div&gt; &lt;link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" /&gt; &lt;script src="http://code.jquery.com/jquery-1.9.1.js"&gt;&lt;/script&gt; &lt;script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"&gt;&lt;/script&gt; &lt;link rel="stylesheet" href="/resources/demos/style.css" /&gt; &lt;script&gt; $(function() { $( ".datepicker" ).datepicker(); $( "#format" ).change(function() { $( ".datepicker" ).datepicker( "option", "dateFormat", $( this ).val() ); }); }); &lt;/script&gt; &lt;script&gt; $(function() { $( "#from" ).datepicker({ defaultDate: "+1w", changeMonth: true, numberOfMonths: 3, onClose: function( selectedDate ) { $( "#to" ).datepicker( "option", "minDate", selectedDate ); } }); $( "#to" ).datepicker({ defaultDate: "+1w", changeMonth: true, numberOfMonths: 3, onClose: function( selectedDate ) { $( "#from" ).datepicker( "option", "maxDate", selectedDate ); } }); }); &lt;/script&gt; &lt;/form&gt; &lt;/div&gt; &lt;/body&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload