Search code examples
jquerytwitter-bootstrap-3eonasdan-datetimepicker

How to hide the time part using bootstrap datepicker


How to hide the time in my datetime picker?

I want to hide my timer bar in my calendar control.

When I select my date by default it shows the time in textbox, I want to hide that in my text input and in my calendar too.

Moreover I want to hide past dates.

Here I have created plunker

<div class='col-sm-6'>
    <input type='text' class="form-control" id='datetimepicker4' />
</div>
<script type="text/javascript">
    $(function () {
        $('#datetimepicker4').datetimepicker();
    });
</script>

Solution

  • To show only date use format: 'L'. The previous dates can be disabled by using minDate.

    $('#datetimepicker4').datetimepicker({
        format: 'L',
        minDate: new Date()
    });
    

    See updated plunker here.