I have two datepickers input in my form using Jquery UI's Datepicker. I need help formatting the date into my own specific format. I declared two variables for each datepicker's ID like this .datepicker({ dateFormat: 'dd/mmm/yyyy' }).val();, but looks like i'm doing it wrong.
var date2 = $('#datepicker2').datepicker({
dateFormat: 'dd/mmm/yyyy'
}).val();
var date3 = $('#datepicker3').datepicker({
dateFormat: 'dd/mmm/yyyy'
}).val();
$(function() {
$("#datepicker2").datepicker();
});
$(function() {
$("#datepicker3").datepicker();
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.min.js"></script>
Input Data Date:
<input type="text" class="form-control" name="p2" id="datepicker2"><br>
Birth Date:
<input type="text" class="form-control" name="p2" id="datepicker3"><br>
When i choose a date, what i got is mm/dd/yyy. Can anyone help me, please?