HTML
CSS
JavaScript
HTML
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
<title>Material_Design风格的时间选择器 Bootstrap-material-datetimepicker - 光年(Light Year Admin)后台管理系统模板</title>
<link rel="icon" href="favicon.ico" type="image/ico">
<meta name="keywords" content="LightYear,光年,后台模板,后台管理系统,光年HTML模板">
<meta name="description" content="LightYear是一个基于Bootstrap v3.3.7的后台管理系统的HTML模板。">
<meta name="author" content="yinqi">
<link href="http://lyear.itshubao.com/iframe/css/bootstrap.min.css" rel="stylesheet">
<link href="http://example.itshubao.com/demo/css/materialdesignicons.min.css" rel="stylesheet">
<link href="http://libs.itshubao.com//bootstrap-material-datetimepicker/bootstrap-material-datetimepicker.min.css" rel="stylesheet">
<link href="http://lyear.itshubao.com/iframe/css/style.min.css" rel="stylesheet">
<style>

</style>
</head>
  
<body>
<div class="container-fluid">
  
  <div class="row">
    <div class="col-md-12">
      <div class="card">
        <div class="card-header"><h4>Material_Design风格的时间选择器 Bootstrap-material-datetimepicker</h4></div>
        <div class="card-body">
          
          <div class="form-group">
            <label for="date-picker">日期选择器</label>
            <input type="text" id="date-picker" class="form-control" placeholder="日期" />
          </div>
          <div class="form-group">
            <label for="time-picker">时间选择器</label>
            <input type="text" id="time-picker" class="form-control" placeholder="时间" />
          </div>
          <div class="form-group">
            <label for="date-format">日期时间</label>
            <input type="text" id="date-format" class="form-control" placeholder="开始日期时间" />
          </div>
          <div class="form-group">
            <label for="min-date">最小日期</label>
            <input type="text" id="min-date" class="form-control" placeholder="开始日期" />
          </div>
          <div class="form-group">
            <label for="date-start">事件</label>
            <div class="input-group">
              <input class="form-control" type="text" id="date-start" placeholder="从" />
              <span class="input-group-addon"><i class="mdi mdi-chevron-right"></i></span>
              <input class="form-control" type="text" id="date-end" placeholder="至" />
            </div>
          </div>
          
        </div>
      </div>
    </div>
    
  </div>
  
</div>

<script type="text/javascript" src="http://lyear.itshubao.com/iframe/js/jquery.min.js"></script>
<script type="text/javascript" src="http://lyear.itshubao.com/iframe/js/bootstrap.min.js"></script>
<script type="text/javascript" src="http://lyear.itshubao.com/iframe/js/bootstrap-datetimepicker/moment.min.js"></script><!--这个文件在原模板的bootstrap-datetimepicker中有,这里将它挪出来了-->
<script type="text/javascript" src="http://lyear.itshubao.com/iframe/js/bootstrap-datetimepicker/locale/zh-cn.js"></script>
<script type="text/javascript" src="http://libs.itshubao.com/bootstrap-material-datetimepicker/bootstrap-material-datetimepicker.min.js"></script>
</body>
</html>
CSS

  
JavaScript
$(document).ready(function(){
    // 日期
    $('#date-picker').bootstrapMaterialDatePicker({
        time: false,
        //lang: 'zh-cn', // 已将默认改成zh-cn
		clearButton: true
    });
    // 时间
    $('#time-picker').bootstrapMaterialDatePicker({
        date: false,
		shortTime: false,
		format: 'HH:mm'
    });
    // 日期时间格式化
    $('#date-format').bootstrapMaterialDatePicker({
        format : 'YYYY-MM-DD HH:mm'
    });
    // 最小日期
    $('#min-date').bootstrapMaterialDatePicker({
        format : 'YYYY-MM-DD HH:mm',
        minDate : new Date()
    });
    // 事件
    $('#date-end').bootstrapMaterialDatePicker({
        weekStart : 0,
        format: 'YYYY-MM-DD HH:mm'
    });
    $('#date-start').bootstrapMaterialDatePicker({ 
        weekStart : 0,
        format: 'YYYY-MM-DD HH:mm',
        shortTime : true
    }).on('change', function(e, date) {
        $('#date-end').bootstrapMaterialDatePicker('setMinDate', date);
    });
});