How to change Date format (dd-mmm-yyyy) in bootstrap datepicker

nazmul.3026 picture nazmul.3026 · Oct 30, 2017 · Viewed 14.4k times · Source

Script

<script>
  $(function () {
    $(".datepicker").datepicker();
  });
</script>

Textbox

<input class="datepicker" id="_Date" name="Date" type="text" value="01-Jan-2017">

enter image description here

When I select date form textbox then the format looks like 10/11/2017 but I need the format like 11-Oct-2017

Answer

Amal picture Amal · Oct 30, 2017

You can achieve this by using format option of bootstrap datepicker

$(function () {
    $('.datepicker').datepicker({
        format: 'd-M-yyyy'
    });
});

d: Numeric date

M: Abbreviated month names

yyyy: 4-digit years

DEMO