bootstrap date formate得到错误的结果

时间:2016-01-31 08:07:14

标签: angular-ui-bootstrap

我希望在dd / MM / yyyy中使用日期格式化

使用js和css

<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.37/js/bootstrap-datetimepicker.min.js"></script>

我的jquery脚本

$(function(){             $( '#出生日期')。的DateTimePicker({                 格式:'dd / mm / yyyy'             });         });

但输出

涂/ 00 / yyyy的

1 个答案:

答案 0 :(得分:0)

您的格式应如下所示:“DD / MM / YYYY”

$(function () {
    $('#DateOfBirth').datetimepicker({
        format: "DD/MM/YYYY"
    });
});
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/>
<link href="https://cdn.rawgit.com/Eonasdan/bootstrap-datetimepicker/e8bddc60e73c1ec2475f827be36e1957af72e2ea/build/css/bootstrap-datetimepicker.css" rel="stylesheet"/>

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.9.0/moment-with-locales.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.37/js/bootstrap-datetimepicker.min.js"></script>


<div style="position: relative">
  <input type="text" id="DateOfBirth" class="form-control" />
</div>