I am trying to select data from sql date where date between range of two textbox with datepicketer,
the problem is it doesn't filter by the date right,
for example the dates in sql are in 28-10-2020, if from date textbox = 28-10-2020 and to date textbox = 25-11-2020 , it will not show any data, but if from date textbox = 28-10-2020 and to date textbox = 30-11-2020 , it will show the data
I don't why this is happening, although the two textbox date and sql date have the same date format (dd-MM-YYYY)
any help will be appreciated.
if (TextBox_from_date.Text != String.Empty && TextBox_to_date.Text != String.Empty)
{
command += " AND FORMAT(requests_table.[req_apply_time],'dd-MM-yyyy') BETWEEN '" + TextBox_from_date.Text + "' AND '" + TextBox_to_date.Text + "' ";
}
datepicker for textbox:
<script type="text/javascript">
$(document).ready(function () {
$(function () {
$("#TextBox_from_date").datepicker({
dateFormat: 'dd-MM-YYYY'
});
});
});
</script>
<script type="text/javascript">
$(document).ready(function () {
$(function () {
$("#TextBox_to_date").datepicker({
dateFormat: 'dd-mm-yy'
});
});
});
</script>