bootstrap3 时间日期选择器

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'


        });



你可能感兴趣的:(JavaScript)