I want to create this format on bootstrap date-picker.e.g 08/01/2020. Mine show this format on the form,eg. 01/08/2020(which is not correct from the form when date is selected) Here is my code for this logic.
Salman BegRank #284 · 8.8K reputationPosted Jan 8, 2020, 9:38 PM EST
0
You need to change the format of bootstrap datepicker. Follow up with this link and change your format,
https://bootstrap-datepicker.readthedocs.io/en/latest/
0
Sanwar RanwaRank #23 · 44.7K reputationPosted Jan 8, 2020, 9:48 PM EST
0
Hi Gcobani
You can format date according to your requirements
Sandhiya PriyaRank #26 · 43.2K reputationPosted Jan 5, 2026, 10:39 PM EST
0
the issue is that you’re mixing up jQuery UI Datepicker options with Bootstrap Datepicker options.
Bootstrap Datepicker does not use dateFormat. Instead, it uses the option format. That’s why your code is showing 01/08/2020 instead of 08/01/2020.
Here’s how you can fix it:
HTML / XML
To
$(document).ready(function() {
var year = (new Date).getFullYear();
$('.input-daterange').datepicker({
format: "dd/mm/yyyy", // Correct option for Bootstrap Datepicker
autoclose: true,
startDate: new Date(year, 0, 1), // use startDate instead of minDate
endDate: new Date(year, 11, 31) // use endDate instead of maxDate
});
});
Key Fixes:
Use format: "dd/mm/yyyy" instead of dateFormat.
Use startDate and endDate instead of minDate and maxDate (those are jQuery UI options).
Ensure your placeholders match the format you expect (dd/mm/yyyy).
Now when you select January 8, 2020, it will correctly show 08/01/2020.
Ashutosh GuptaRank #805 · 2.9K reputationPosted Jan 8, 2020, 11:40 PM EST