Categories
JavaScript Answers

How to disable time in Bootstrap date time picker with JavaScript?

Spread the love

To disable time in Bootstrap date time picker with JavaScript, we call the datetimepicker method with an object with the format property.

For instance, we write

<input data-format="yyyy-MM-dd" type="text" id="datetimepicker4" />

to add a date time picker input.

Then we write

$("#datetimepicker4").datetimepicker({
  format: "YYYY-MM-DD",
});

to select the input with $ and call datetimepicker with an object that sets the format to "YYYY-MM-DD".

The the time picker will be disabled in the date time picker.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published.