bootstrap datepicker setDate format dd/mm/yyyy

前端 未结 12 896
轮回少年
轮回少年 2021-02-03 20:14

I have to set the date in my datepicker in dd/mm/yyyy format. Whet I\'m trying to do, with Javascript is this:

  var year = 2014;
  var month = 5;
  var day = 10         


        
相关标签:
12条回答
  • 2021-02-03 20:37

    Change

    dateFormat: 'dd/mm/yyyy'
    

    to

    format: 'dd/mm/yyyy'
    

    Looks like you just misread some documentation!

    0 讨论(0)
  • 2021-02-03 20:37

    for me it is daterangepicker worked by this :

         $('#host1field').daterangepicker({
                       locale: {
                                format: 'DD/MM/YYYY'
                                }
                     });
    
    0 讨论(0)
  • 2021-02-03 20:38

    You can use this code for bootstrap datepicker:

    HTML Code:

    <p>Date: <input type="text" id="datepicker" class="datepicker"></p>
    

    Javascript:

    $( ".datepicker" ).datepicker({
       format: 'yyyy-mm-dd'
    });
    
    0 讨论(0)
  • 2021-02-03 20:39

    a bit change in format

    format : "DD/MM/YYYY"

    0 讨论(0)
  • 2021-02-03 20:42

    Changing to format: 'dd/mm/yyyy' didn't work for me, and changing that to dateFormat: 'dd/mm/yyyy' added year multiple times, The finest one for me was,

    dateFormat: 'dd/mm/yy'
    
    0 讨论(0)
  • 2021-02-03 20:43

    This line of code works for me

    $("#datepicker").datepicker("option", "dateFormat", "dd/mm/yy");
    

    you can change the id #datepicker with the class .input-group.date of course

    0 讨论(0)
提交回复
热议问题