官方中文地址:http://www.bootcss.com/p/bootstrap-datetimepicker/index.htm
示例代码:
<!DOCTYPE html>
<html>
<head>
<title></title>
<link href="{{ url_for("static",filename="bootstrap/css/bootstrap.min.css") }}" rel="stylesheet" media="screen">
<link href="{{ url_for("static",filename="bootstrap-datetimepicker.min.css") }}" rel="stylesheet" media="screen">
</head>
<body>
<script src="//cdn.bootcss.com/jquery/2.2.4/jquery.min.js"></script>
<script type="text/javascript" src="{{ url_for("static",filename="bootstrap/js/bootstrap.min.js") }}"></script>
<script type="text/javascript" src="{{ url_for("static",filename="bootstrap-datetimepicker.js") }}" charset="UTF-8"></script>
<script type="text/javascript" src="{{ url_for("static",filename="moment.js") }}"></script>
<div class="row" id="timepickzone">
<div class='col-sm-6'>
<div class="form-group">
<div class='input-group date' id='datetimepicker1'>
<input type='text' class="form-control" />
<span class="input-group-addon">
<span class="glyphicon glyphicon-calendar"></span>
</span>
</div>
</div>
</div>
<div class='col-sm-6'>
<div class="form-group">
<div class='input-group date' id='datetimepicker2'>
<input type='text' class="form-control" />
<span class="input-group-addon">
<span class="glyphicon glyphicon-calendar"></span>
</span>
</div>
</div>
</div>
</div>
<input type="button" class="query" value="点击">
<script type="text/javascript">
$(function () {
$('#datetimepicker1').datetimepicker({locale: 'zh-cn',autoclose:true});
$('#datetimepicker2').datetimepicker({locale: 'zh-cn',autoclose:true});
$('.query').click(function(){
//取出时间戳
var datetime1 =$('#datetimepicker1').data().date;
var datetimestamp = Date.parse(datetime1).toString();
var dts = datetimestamp.substr(0,datetimestamp.length-3);
console.log(dts);
});
});
</script>
</body>
</html>