Reputation: 3082
I have added jQuery datepicker to my MVC4 application so that on click of a text box a calendar control appears and from the selection the date is posted into the textbox in the format MM/DD/YYYY
I want to return this in the format DD/MM/YYYY but have been unable to do so. My code is as follows:
<script type="text/javascript">
$(document).ready(function () {
$('#expirydate').datepicker()
.datepicker({ dateFormat: 'dd/mm/yy' });
});
</script>
What am I doing wrong here? If I try to post in the format MM/DD/YYYY then my application is throwing in invalid date error
Upvotes: 0
Views: 548
Reputation: 4529
Change
.datepicker({ dateFormat: 'dd/mm/yy' });
to
.datepicker({ dateFormat: 'dd/mm/yyyy' });
Upvotes: 1