• bootstrap-datetimepicker


    <link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css">
    <link href="../Content/bootstrap-datetimepicker.min.css" rel="stylesheet" />
    <link href="../Content/bootstrap-select.min.css" rel="stylesheet" />
    
    <!-- ÒýÈëbootstrapÑùʽ -->
    <link href="https://cdn.bootcss.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet">
    <!-- ÒýÈëbootstrap-tableÑùʽ -->
    <link href="https://cdn.bootcss.com/bootstrap-table/1.11.1/bootstrap-table.min.css" rel="stylesheet">
    
    <!-- jquery -->
    <script src="https://cdn.bootcss.com/jquery/2.2.3/jquery.min.js"></script>
    <!--时间控件-->
    <script src="../Scripts/bootstrap-datetimepicker.min.js"></script>
    <script src="../Scripts/bootstrap-select.min.js"></script>
    <script src="https://cdn.bootcss.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
    
    <!-- bootstrap-table.min.js -->
    <script src="https://cdn.bootcss.com/bootstrap-table/1.11.1/bootstrap-table.min.js"></script>
    <!-- ÒýÈëÖÐÎÄÓïÑÔ°ü -->
    <script src="https://cdn.bootcss.com/bootstrap-table/1.11.1/locale/bootstrap-table-zh-CN.min.js"></script>
    //  转化时间格式
       // 转时间格式
        function changeDateFormat(cellval) {
            var dateVal = cellval + "";
            if (cellval != null) {
                var date = new Date(parseInt(dateVal.replace("/Date(", "").replace(")/", ""), 10));
                var month = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
                var currentDate = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
    
                var hours = date.getHours() < 10 ? "0" + date.getHours() : date.getHours();
                var minutes = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
                var seconds = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
    
                return date.getFullYear() + "-" + month + "-" + currentDate;//+ " " + hours + ":" + minutes + ":" + seconds;
            }
        }
    $('#birthdayDate').datetimepicker({
            language: 'zh-CN',//显示中文
            format: 'yyyy-mm-dd',//显示格式
            minView: "month",//设置只显示到月份
            initialDate: new Date(),
            autoclose: true,//选中自动关闭
            todayBtn: true,//显示今日按钮
            //locale: moment.locale('zh-cn')
        });
    //  赋值 时间为当前时间
    
    
     //默认获取当前日期
        var today = new Date();
        var nowdate = (today.getFullYear()) + "-" + (today.getMonth() + 1) + "-" + today.getDate();
        //对日期格式进行处理
        var date = new Date(nowdate);
        var mon = date.getMonth() + 1;
        var day = date.getDate();
        var mydate = date.getFullYear() + "-" + (mon < 10 ? "0" + mon : mon) + "-" + (day < 10 ? "0" + day : day);
        //日期时间控件默认值的设置,需要注意的是,在JS中使用的ID是input标签的ID。
        document.getElementById("inbirthdayDate").value = mydate;
    使用方法
    
    
      <a class='input-group date' id='birthdayDate'>
                            <input type='text' class="form-control" id='inbirthdayDate' style=" 150px; height: 30px;" />
                            <span class="input-group-addon" style="float: left;  50px; height: 30px;">
                                <span class="glyphicon glyphicon-calendar"></span>
                            </span>
                        </a>
  • 相关阅读:
    第十三课、计算器核心解析算法(中)------------------狄泰软件学院
    Machine Learning in Action(1) K-*邻
    Machine Learning in Action(0) 开篇
    machine learning for hacker记录(3) 贝叶斯分类器
    machine learning for hacker记录(2) 数据分析
    machine learning for hacker记录(1) R与机器学习
    Hive性能优化
    博客园
    机器学习:CART
    机器学习:线性回归
  • 原文地址:https://www.cnblogs.com/hnzheng/p/9510752.html
Copyright © 2020-2023  润新知