时间插件

<!DOCTYPE html>
<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>datetimpicker测试</title>
    <!--图标样式-->
    <link href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
    <link href="https://cdn.bootcss.com/bootstrap-datetimepicker/4.17.47/css/bootstrap-datetimepicker.min.css" rel="stylesheet">
    <script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.js"></script>
    <script src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
    <script src="https://cdn.bootcss.com/moment.js/2.24.0/moment-with-locales.js"></script>
    <!-- 这个必须放前面 -->
    <script src="https://cdn.bootcss.com/bootstrap-datetimepicker/4.17.47/js/bootstrap-datetimepicker.min.js"></script>
   
 <!-- <script src="./bootstrap.min.css"></script>
<link href="./bootstrap-datetimepicker.min.css">
<script src="./jquery.js"></script> 
<script src="./moment-with-locales.js"></script> 
<script src="./bootstrap.min.js"></script> -->
</head>
<style>
    .col-sm-6{
        width: 20%;
    }
</style>

<body>
<div class="row">
    <div class='col-sm-6'>
        <div class="form-group">
            <label>选择日期:</label>
            <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">
            <label>选择日期+时间:</label>
            <!--指定 date标记-->
            <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 class='col-sm-6'>
        <div class="form-group">
            <label>选择日期+时间:</label>
            <!--指定 date标记-->
            <div class='input-group date' id='datetimepicker3'>
                <input type='text' class="form-control" />
                <span class="input-group-addon">
                    <span class="glyphicon glyphicon-calendar"></span>
                </span>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">

    $(function () {
        $('#datetimepicker1').datetimepicker({
            format: 'YYYY-MM-DD',
            locale: moment.locale('zh-cn'),
            defaultDate: "2020-02-08",

        });
        let data = new Date()
        $('#datetimepicker2').datetimepicker({
            format: 'YYYY-MM-DD HH:mm:ss',
            locale: moment.locale('zh-CN'),
            defaultDate: data.getFullYear()+'-'+(data.getMonth()+1)+'-'+data.getDate()+' 00:00:00'
        });
        $('#datetimepicker3').datetimepicker({
            format: 'YYYY-MM-DD hh:mm:ss',
            locale: moment.locale('zh-cn'),
            defaultDate:new Date()
        });
    });
</script>
</body>
</html>

时间插件

上一篇:Tomcat的国际化实现


下一篇:服务器配置 centos8配置中文显示