Disable time in bootstrap date time picker

前端 未结 20 1412
夕颜
夕颜 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:38

    I know this is late, but the answer is simply removing "time" from the word, datetimepicker to change it to datepicker. You can format it with dateFormat.

          jQuery( "#datetimepicker4" ).datepicker({
            dateFormat: "MM dd, yy",
          });
    
    0 讨论(0)
  • 2021-01-30 08:39
    your same code work's fine, just add some link reference
    
    <!DOCTYPE HTML>
    <html>
        <head>
            <link href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.2.2/css/bootstrap-combined.min.css" rel="stylesheet">
            <link rel="stylesheet" type="text/css" media="screen"
                  href="http://tarruda.github.com/bootstrap-datetimepicker/assets/css/bootstrap-datetimepicker.min.css">
    
    
        </head>
        <body>
            <div class="well">
                <div id="datetimepicker4" class="input-append"> 
                    <input data-format="yyyy-MM-dd" type="text"></input> 
                    <span class="add-on"> 
                        <i data-time-icon="icon-time" data-date-icon="icon-calendar"> </i> 
                    </span> 
                </div> 
            </div> 
    
            <script type="text/javascript"
                    src="http://cdnjs.cloudflare.com/ajax/libs/jquery/1.8.3/jquery.min.js">
            </script> 
            <script type="text/javascript"
                    src="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.2.2/js/bootstrap.min.js">
            </script>
            <script type="text/javascript"
                    src="http://tarruda.github.com/bootstrap-datetimepicker/assets/js/bootstrap-datetimepicker.min.js">
            </script>
            <script type="text/javascript"
                    src="http://tarruda.github.com/bootstrap-datetimepicker/assets/js/bootstrap-datetimepicker.pt-BR.js">
            </script>
            <script type="text/javascript">
                $(function () {
                    $('#datetimepicker4').datetimepicker({pickTime: false});
                });
            </script>
    
        </body>
        </html>
    
    0 讨论(0)
  • 2021-01-30 08:39

    This allows to show time in input field but hides time picker button, which is second li element in accordion

    .bootstrap-datetimepicker-widget .list-unstyled li:nth-child(2){
        display: none;
    }
    
    0 讨论(0)
  • 2021-01-30 08:40
        $(function () {
            $('#datetimepicker9').datetimepicker({
                viewMode: 'years',
                format: 'DD/MM/YYYY' /*Add this line to remove time format*/
            });
        });
    
    0 讨论(0)
  • 2021-01-30 08:40

    For bootstrap 4 version this code working;

    $('#payment-date-time-select').datetimepicker({
        startView:2,
        minView:2,
    });
    
    0 讨论(0)
  • 2021-01-30 08:41

    Disable time in boostrap datetime picker...

       $(document).ready(function () {
            $('.timepicker').datetimepicker({
                format: "dd-mm-yy",
            });
        });
    

    Disable date in boostrap datetime picker...

       $(document).ready(function () {
            $('.timepicker').datetimepicker({
                format: "HH:mm A",
            });
        });
    
    0 讨论(0)
提交回复
热议问题