Emre BEGEN
Emre BEGEN

Reputation: 597

How to disable time in Bootstrap DateTimePicker?

I wanna use bootstrap datetimepicker without select time but it is not working. I gave false value to the pickTime parameter but it is still not working. But Format and language parameters is working.

Here is the code! How can i fix this?

<script type="text/javascript">
      $(function () {
         $('#datetimepicker1').datetimepicker({
            format: "dd MM yyyy",
            pickTime: false,
            autoclose: true,
            todayBtn: true,
            language: 'tr',
            pickerPosition: "bottom-right"          
            });
        });
</script>



<div class='input-group date' id='datetimepicker1'>

     <span class="input-group-addon">Birtdate</span>
     <input type='text' class="form-control" />
      <span class="input-group-addon">
            <span class="glyphicon glyphicon-calendar">  </span>
      </span>
</div>

Upvotes: 10

Views: 42706

Answers (4)

pramod kadam
pramod kadam

Reputation: 1327

try this remove pickTime Option and use minview : 2

$(function() {
  $('#datetimepicker4').datetimepicker({
    minView : 2
  });
});

Upvotes: 10

Shakthi
Shakthi

Reputation: 175

Try the below code, which will show only the date view, when the calendar is pulled down.

    $(function () {
     $('#datetimepicker1').datetimepicker({
        format: 'yyyy-mm-dd',
            startView: 'month',
            minView: 'month',
            autoclose: true          
        });
    });

Upvotes: 6

Nguyen Linh
Nguyen Linh

Reputation: 266

There are many datetimepicker plugin, so you need to details what plugin you used. If you use the plugin from http://eonasdan.github.io/bootstrap-datetimepicker/. I think, you may use wrong its option : read more at http://eonasdan.github.io/bootstrap-datetimepicker/Options/. Here I removed almost, and just keep one:

    $('#datetimepicker1').datetimepicker({
        format: "dd MM yyyy"         
    });

Upvotes: 13

Dee
Dee

Reputation: 714

I found this website online it disables the time picker

http://tarruda.github.io/bootstrap-datetimepicker/
<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">
  $(function() {
    $('#datetimepicker4').datetimepicker({
      pickTime: false
    });
  });
</script>

Upvotes: 3

Related Questions