-5

I am using datepicker for calender, but it works good for mm/dd/yyyy.

And not working for dd/mm/yyyy format.. how can do it in dd/mm/yyyy format??

Code Snippet:

var newAvaDateForm = "28/07/2017";

var plusNintyDays = "25/10/2017";

$('#date1').datepicker({
   format: 'dd/mm/yyyy', 
   minDate:newAvaDateForm,
   maxDate:plusNintyDays,
   autoclose:1
});

Now my project on live mode.. i cant change plugin.

so many operations on that calender.

so please suggest me how to change it in dd/mm/yyyy format??

Also changed "format" to "dateFormat".. though its not working??

  • 1
    Possible duplicate of [bootstrap datepicker setDate format dd/mm/yyyy](https://stackoverflow.com/questions/23725988/bootstrap-datepicker-setdate-format-dd-mm-yyyy) – Alexander Jul 14 '17 at 05:06
  • Use lowercase in your format string and will be happy! See [documentation](http://bootstrap-datepicker.readthedocs.io/en/latest/options.html#format) for details. – Alexander Jul 14 '17 at 05:08
  • change format to dateformat – Nithin Jul 14 '17 at 05:09
  • 2
    Possible duplicate of [jQueryUI.DatePicker How to change Date in format dd/mm/yyyy?](https://stackoverflow.com/questions/34605133/jqueryui-datepicker-how-to-change-date-in-format-dd-mm-yyyy) – Hassan Imam Jul 14 '17 at 05:10

2 Answers2

2

See the documentation here.

You need to pass the key as dateFormat, and the format is also invalid. Try this:

$('#date1').datepicker({
   dateFormat: 'dd/mm/yy', 
   minDate:newAvaDateForm,
   maxDate:plusNintyDays,
   autoclose:1
});
31piy
  • 23,323
  • 6
  • 47
  • 67
0

Change format: 'dd/mm/yyyy', to dateFormat: 'dd/mm/yy',. This will allow you to display date in dd/mm/yyyy format.

var newAvaDateForm = "28/07/2017";
var plusNintyDays = "25/10/2017";

$('#date1').datepicker({
   dateFormat: 'dd/mm/yy', 
   minDate:newAvaDateForm,
   maxDate:plusNintyDays,
   autoclose:1
});
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.12.4.js"></script>
<script src="//code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
Date: <input type="text" id="date1">
Hassan Imam
  • 21,956
  • 5
  • 41
  • 51