0

Using Jquery and the Bootstrap Datetimepicker, how can I get the datetime value I selected using the Bootstrap Datepicker? Here is the link of datetime picker I am using datetime-picker

Here is my Html:

<div style="overflow:hidden;">
<div class="form-group">
    <div class="row">
        <div class="col-md-8">
            <div id="datetimepicker12"></div>
         </div>
      </div>
   </div>
</div>

Here is my j s:

<script type="text/javascript">
$(function () {
    $('#datetimepicker12').datetimepicker({
        inline: true,
        sideBySide: true
    });
});

1

2 Answers 2

2

Try calling the date

$('#datetimepicker12').data("DateTimePicker").date();

From docs:

Returns the component's model current date, a moment object or null if not set.

Sign up to request clarification or add additional context in comments.

Comments

0

Here is the change

 <div id="datetimepicker12"><input type="text" class="form-control" id="selectedDate"></div>

You can get the value using input field id selector or you can get the value in form submission if that in inside a form

2 Comments

Your Answer is not correct..But your answer gave me a right direction..Thanks.
I am using "inline" type datetime picker and I don't have textbox.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.