Hello @Adeel Mirza
try something like this , your need to initialize the date format
var date = $('#datepicker').datepicker({ dateFormat: 'dd-mm-yy' }).val();
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I am using this source code to implement calendar control. But its not taking the data format is dd/mm/yy. Why?
<script type="text/javascript">
$(function () {
var date = new Date();
var currentMonth = date.getMonth();
var currentDate = date.getDate();
var currentYear = date.getFullYear();
$('#ContentPlaceHolder1_txtVisitingDateTill').datepicker({
dateFormat: 'dd/mm/yy',
maxDate: new Date
});
return currentDate + '-' + currentMonth + '-' + currentYear;
});
</script>
Hello @Adeel Mirza
try something like this , your need to initialize the date format
var date = $('#datepicker').datepicker({ dateFormat: 'dd-mm-yy' }).val();
Hi @Adeel Mirza ,
For the boot date picker, you must use the following code:
$( ".datepicker" ).datepicker({
format:'yyyy-mm-dd',
maxDate: new Date()
});
For jquery datepicker, the following code must be used:
$( ".datepicker" ).datepicker({
dateFormat:'dd-mm-yy',
maxDate: new Date()
});
So you must know which date picker you are using, this can finally solve your problem, hope this helps you.
Best regards,
Lan Huang
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.