bootstrap3 时间日期选择器

来源:互联网 发布:不宜乐乎的乐怎么读 编辑:程序博客网 时间:2024/04/26 09:22

http://eonasdan.github.io/bootstrap-datetimepicker/


下载css&js

https://github.com/Eonasdan/bootstrap-datetimepicker


引入CSS

 <link href="/static/css/bootstrap-datetimepicker.min.css" rel="stylesheet">


引入JS

<script src="/static/js/moment.min.js"></script>

<script src="/static/js/bootstrap-datetimepicker.min.js"></script>


datetimepicker css &js 分别放在bootstrap css&js 后面


将input 放到span或div内

            <span class="glyphicon glyphicon-time"></span>                <label for="start_time">                    开始时间:                 </label>            <span>                <input id="strtime" data-date-format="YYYY-MM-DD HH:mm:ss" name="strtime" >            </span>


初始化

 $('#strtime,#endtime').datetimepicker({
            pickDate: true,                 //en/disables the date picker
            pickTime: true,                 //en/disables the time picker
            useMinutes: true,               //en/disables the minutes picker
            useSeconds: true,               //en/disables the seconds picker
            useCurrent: true,               //when true, picker will set the value to the current date/time
            minuteStepping: 1,               //set the minute stepping
            pick12HourFormat: false,
            lang: 'cn'


        });



0 0
原创粉丝点击