无法使用 Jquery datetimepicker 格式化选定的日期时间

Could not format the selected date time using Jquery datetimepicker

我需要在从 Jquery datetimepicker 中选择值时格式化日期和时间。我在下面解释我的代码。

<!doctype html>
<html>
    <head>
       <title>jQuery Datepicker UI Example - Demo Preview</title>
       <meta name="robots" content="noindex, nofollow"/>
       <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.js"></script> 


       <script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.4/jquery-ui.js"></script> 
       <link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha/css/bootstrap.css" rel="stylesheet">
       <link rel="stylesheet" type="text/css" href="jquery.datetimepicker.min.css"/>
       <script src="jquery.datetimepicker.js"></script>

       <style type="text/css">
           .bootstrap-datetimepicker-widget.dropdown-menu.bottom {
               top: 26px !important;
           }
       </style>
    </head>

    <body>
        <div class="container">
            <div class="row">
                <div class="col-sm-12 top-buffer">
                    <h3>DatePicker Example</h3>
                    <input type="text" id="datetimepicker"/>
                </div>
            </div>
            <div class="bottom-buffer"></div>
       </div>

       <script type="text/javascript">
           $(document).ready(function() {
               $('#datetimepicker').datetimepicker({ format:'dd-mm-yyyy'});
           });
       </script>
   </body>
<html>

在这里,我需要从日历中选择值后,输入字段的值格式应类似于 dd-mm-yyyy hh:ii AM/PM or 23-10-2018 1.30 PM

请帮我解决这个问题。

试试这个,

 $(document).ready(function() {
        $('#datetimepicker').datetimepicker({
        format:'d.m.Y H:i:a',
        formatTime:'h:i:a'

        });
    });