"Bootstrap 4 datetimepicker in the modal"
Bootstrap 4.1.1 Snippet by nitesh575malviya

<link href="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script> <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <!------ Include the above in your HEAD tag ----------> <link rel="stylesheet" href="https://netdna.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.css" /> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/tempusdominus-bootstrap-4/5.0.1/css/tempusdominus-bootstrap-4.min.css" /> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.22.2/moment.min.js"></script> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/tempusdominus-bootstrap-4/5.0.1/js/tempusdominus-bootstrap-4.min.js"></script> <div class="container"> <div class="row mt-5"> <div class="col-lg-12"> <div class=" text-center"> <h4 class="font-weight-normal">datetimepicker in the modal</h4> <p class="pb-5">Bootstrap 4</p> <!-- Button trigger modal --> <button type="button" class="btn btn-success" data-toggle="modal" data-target="#exampleModal"> START EXAM </button> </div> <!-- modal start here --> <div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title" id="exampleModalLabel">Exam date time</h5> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">×</span> </button> </div> <div class="modal-body"> <div class="form-group mb-4"> <label>Start Time</label> <div class="input-group date" id="datetimepicker12" data-target-input="nearest"> <input type="text" class="form-control datetimepicker-input" data-target="#datetimepicker12"/> <div class="input-group-append" data-target="#datetimepicker12" data-toggle="datetimepicker"> <div class="input-group-text"><i class="fa fa-calendar"></i></div> </div> </div> </div> <div class="form-group"> <label>End Time</label> <div class="input-group date" id="datetimepicker13" data-target-input="nearest"> <input type="text" class="form-control datetimepicker-input" data-target="#datetimepicker13"/> <div class="input-group-append" data-target="#datetimepicker13" data-toggle="datetimepicker"> <div class="input-group-text"><i class="fa fa-calendar"></i></div> </div> </div> </div> </div> <div class="modal-footer py-5"> <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button> <button type="button" class="btn btn-primary">Save changes</button> </div> </div> </div> </div> <!-- modal end here --> </div> </div> </div>
$('#datetimepicker12').datetimepicker({ defaultDate: new Date(), format: 'YYYY-MM-DD hh:mm:ss A' }); $('#datetimepicker13').datetimepicker({ defaultDate: new Date(), format: 'YYYY-MM-DD hh:mm:ss A' });

Related: See More


Questions / Comments: