Bootstrap Datetimepicker Disable Weekends Example
Hi Dev,
Today,i will learn you simple example of Bootstrap datetimepicker disable weekends.you can disable bootstrap datetimepicker using daysOfWeekDisabled method.we are disabled bootstrap datetimepicker in weekends.it will useing daysOfWeekDisabled options to disable weekends in bootstrap datetimepicker.
Here following example of bootstrap datetimepicker disable weekends.
Solution$(function () { $('#datetimepicker1').datetimepicker({ daysOfWeekDisabled: [0,6] }); });Example
<!DOCTYPE html> <html> <head> <title>Bootstrap Datetimepicker Disable Weekends Example</title> <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.9.0/moment.min.js"></script> <link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.47/css/bootstrap-datetimepicker.min.css"> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.47/js/bootstrap-datetimepicker.min.js"></script> </head> <body style="background:#e2e2e2;"> <div class="container"> <h2>Bootstrap Datetimepicker Disable Weekends Example - nicesnippets.com</h2> <div class="row"> <div class='col-sm-6'> <div class="form-group"> <div class='input-group date' id='datetimepicker1'> <input type='text' class="form-control" /> <span class="input-group-addon"> <span class="glyphicon glyphicon-calendar"></span> </span> </div> </div> </div> <script type="text/javascript"> $(function () { $('#datetimepicker1').datetimepicker({ daysOfWeekDisabled: [0,6] }); }); </script> </div> </div> </body> </html>
It will help you..