In my code, I have a calendar where the user selects the period that he wants to analyze. The code is this:
<input type="text" name="daterange" value="01/01/2012 - 20/04/2018" />
<script type="text/javascript">
$(function() {
$('input[name="daterange"]').daterangepicker({
timePicker: false,
timePickerIncrement: 0,
locale: {
format: 'DD/MM/YYYY'
}
});
});
</script>
I need to use this range to filter a mysql data table. I've already used the between
function with two different dates, like this:
SELECT * FROM 'producao_hora' where data between '19/04/2018' and '20/04/2018'
But I'm not sure how to turn the datepicker date range into a variable that I could play in this select
. How could it be done?
Note: PHP codes are also welcome!