<script src="/Content/bootstraps/js/bootstrap.js"></script><script src="/Content/bootstraps/js/bootstrap-datetimepicker.js"></script><script src="/Content/bootstraps/js/bootstrap-datetimepicker.zh-CN.js"></script>其中bootstrap-datetimepicker.zh-CN.js表示可以使用中文的语言显示日期时间
<link href="/Content/bootstraps/css/bootstrap.css" rel="stylesheet"/><link href="/Content/bootstraps/css/bootstrap-datetimepicker.css" rel="stylesheet"/>3 定义HTML标签
<input class="form_datetime form-control" type="text" value="2016-03-07" size="16">4 编写datetimepicker事件
<script type="text/javascript"> $(".form_datetime").datetimepicker({ format: "yyyy-mm-dd", autoclose: true, todayBtn: true, todayHighlight: true, showMeridian: true, pickerPosition: "bottom-left", language: "zh-CN",//中文,需要引用zh-CN.js包 startView: 2,//月视图 minView: 2//日期时间选择器所能够提供的最精确的时间选择视图 }); </script>注意,有很多朋友都在网上问过,如何只用日期,或者不用时间,因为默认情况下,每次使用datetimepicker选择时,都要选到日间那个级别上,很是不爽,大叔在研究中发展,使用minView这个参数解决了这个问题,它相当于在控制上,最小的显示精度,
想要了解更多Bootstrap内容的朋友,可以点击《bootstrap学习教程》 ,深入学习。
以上就是本文的全部内容,希望对大家的学习有所帮助。