Disable time in bootstrap date time picker

前端 未结 20 1387
夕颜
夕颜 2021-01-30 07:56

I am using bootstrap date time picker in my web application, made in PHP/HTML5 and JavaScript. I am currently using one from here: http://tarruda.github.io/bootstrap-datetimepic

相关标签:
20条回答
  • 2021-01-30 08:33
    $('#datetimepicker').datetimepicker({ 
        minView: 2, 
        pickTime: false, 
        language: 'pt-BR' 
    });
    

    Please try if it works for you as well

    0 讨论(0)
  • 2021-01-30 08:34

    Not as put off time and language at a time I put this and not work

    $(function () {
        $('#datetimepicker2').datetimepicker({
                  locale: 'es',
                  pickTime: false
              });
    });
    
    0 讨论(0)
  • 2021-01-30 08:36

    Initialize your datetimepicker like this

    For disable time

    $(document).ready(function(){
        $('#dp3').datetimepicker({
          pickTime: false
        });
    });
    

    For disable date

    $(document).ready(function(){
        $('#dp3').datetimepicker({
          pickDate: false
        });
    });
    

    To disable both date and time

    $(document).ready(function(){
       $("#dp3").datetimepicker('disable'); 
    });
    

    please refer following documentation if you have any doubt

    http://eonasdan.github.io/bootstrap-datetimepicker/#options

    0 讨论(0)
  • 2021-01-30 08:36

    In my case, the option I used was:

    var from = $("input.datepicker").datetimepicker({
      format:'Y-m-d',
      timepicker:false # <- HERE
    });
    

    I'm using this plugin https://xdsoft.net/jqplugins/datetimepicker/

    0 讨论(0)
  • 2021-01-30 08:36

    Here's the solution for you. It's very easy to just add code like this:

        $('#datetimepicker4').datetimepicker({ 
    
        pickTime: false 
    
        minview:2;(Please see here.)
    
        }); 
    
    0 讨论(0)
  • 2021-01-30 08:37

    Check the below snippet

    <div class="container">
    <div class="row">
        <div class='col-sm-6'>
            <div class="form-group">
                <div class='input-group date' id='datetimepicker4'>
                    <input type='text' class="form-control" />
                    <span class="input-group-addon"><span class="glyphicon glyphicon-time"></span>
                    </span>
                </div>
            </div>
        </div>
        <script type="text/javascript">
            $(function() {              
               // Bootstrap DateTimePicker v4
               $('#datetimepicker4').datetimepicker({
                     format: 'DD/MM/YYYY'
               });
            });      
        </script>
    </div>
    

    You can refer http://eonasdan.github.io/bootstrap-datetimepicker/ for documentation and other functions in detail. This should work.

    Update to support i18n

    Use localized formats of moment.js:

    • L for date only
    • LT for time only
    • L LT for date and time

    See other localized formats in the moment.js documentation (https://momentjs.com/docs/#/displaying/format/)

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