Achilles Achilles - 3 years ago 298
HTML Question

Bootstrap Datepicker Format Could Not Change To dd-mm-yyyy

Hi I have the following code and i am trying to change DatePicker as documentation but it did notchange. Please take a look at my javascript code

<script type="text/javascript">
$(function(){
$('#lmp').datepicker({
dateFormat: 'dd-mm-yyyy'
}).on('changeDate', function (ev) {
$(this).datepicker('hide');
});
})
</script>


And This is my HTML Code

<input class="span2" type="text" name="lmp" id="lmp" placeholder="Click To Choose Date" align="left">

Answer Source

Change dateFormat to format

<script type="text/javascript"> 
$(function(){
    $('#lmp').datepicker({
        format: 'dd-mm-yyyy'
    }).on('changeDate',  function (ev) {
        $(this).datepicker('hide');
    }); 
})

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download