Reputation: 31
I want to change the date format from mm/dd/yyyy
to dd/mm/yyyy
.
After the date picker performs its action, I want the dd/mm/yyyy
to display
in the text box.
<script>
$(function() {
var dates = $( "#from, #to" ).datepicker({
defaultDate: "+1w",
changeMonth: true,
numberOfMonths: 1,
onSelect: function( selectedDate ) {
var option = this.id == "from" ? "minDate" : "maxDate",
instance = $( this ).data( "datepicker" ),
date = $.datepicker.parseDate(
instance.settings.dateFormat ||
$.datepicker._defaults.dateFormat,
selectedDate, instance.settings );
dates.not( this ).datepicker( "option", option, date );
}
});
});
</script>
Upvotes: 0
Views: 230
Reputation: 214
Try this:
$('#from, #to').datepicker({ dateFormat: 'dd/mm/yyyy' });
it can help you...
Upvotes: 1
Reputation: 4631
.datepicker({ dateFormat: 'dd-mm-yy' })
using dateFormat option you can change the format of date,rest whatever option you want you can provide it
Upvotes: 0