How to use time control in bootstrap
During this period, I took a look at the time control of bootstrap and found that it is very simple to use. I sorted it out when I had time so that I can refer to it when I forget it in the future. . .
【Related video recommendation: Bootstrap tutorial】
Without further ado, here are the renderings
La
<link href="assets/css/icons.css?1.1.11" rel="stylesheet" /> 后面那个时期样式图片样式<link href="assets/css/bootstrap.css?1.1.11" rel="stylesheet" /> <link href="assets/css/plugins.css?1.1.11" rel="stylesheet" /> 日期控件样式<script src="assets/js/jquery-1.8.3.min.js?1.1.11"></script><script src="assets/js/bootstrap/bootstrap.js?1.1.11"></script> <script src="assets/plugins/core/moment/moment.min.js?1.1.11"></script> moment是一个JavaScript日期处理类库<script src="assets/plugins/forms/daterangepicker/daterangepicker.js?1.1.11"></script> 时间范围控件<script src="assets/plugins/forms/datetimepicker/bootstrap-datetimepicker.min.js?1.1.11"></script><script src="assets/plugins/forms/datetimepicker/bootstrap-datetimepicker.zh-CN.js?1.1.11"></script>这个没有用到可忽视
The second part is html file
<body><div class="col-lg-3 col-md-3"><!-- 这个控制input的宽高 --><div class="input-group"><!--这个控制后面图片与input在一起的 --><input id="adddate" class="form-control" placeholder="申请日期范围" /> <span class="input-group-addon"><i class="fa-calendar"></i></span></div><input onclick="a()" type="button" value="提交"/> <!-- 自己用来测试input中的内容 --></div></body>
<script>$(document).ready(function() {
$('#adddate').daterangepicker({// startDate: moment().startOf('day'), //endDate: moment(), minDate: '2012-01-01', //最小时间 =====>>格式要跟格式化的样式一致 endDate : moment(), //最大时间 dateLimit : {days : 30}, //起止时间的最大间隔 showDropdowns : true,
showWeekNumbers : false, //是否显示第几周 timePicker : false, //是否显示小时和分钟 timePickerIncrement : 60, //时间的增量,单位为分钟 timePicker12Hour : false, //是否使用12小时制来显示时间 ranges : {'最近1小时': [moment().subtract('hours',1), moment()], //moment.js需要详细了解的可以点我一下'今天' : [ moment().startOf('day'), moment() ],'昨天' : [
moment().subtract('days', 1).startOf('day'),
moment().subtract('days', 1).endOf('day') ],'最近7日' : [ moment().subtract('days', 6),
moment() ],'最近30日' : [ moment().subtract('days', 29),
moment() ]
},
opens : 'right', //日期选择框的弹出位置 buttonClasses : [ 'btn btn-default' ],
applyClass : 'btn-small btn-primary blue',
cancelClass : 'btn-small',
format : 'YYYY-MM-DD', //控件中from和to 显示的日期格式 separator : ' 到 ',
locale : {
applyLabel : '确定',
cancelLabel : '取消',
fromLabel : '起始时间',
toLabel : '结束时间',
customRangeLabel : '自定义时间',
daysOfWeek : [ '日', '一', '二', '三', '四', '五','六' ],
monthNames : [ '一月', '二月', '三月', '四月', '五月','六月', '七月', '八月', '九月', '十月', '十一月','十二月' ],
firstDay : 1}
},function(start, end, label) {//格式化日期显示框 $('#adddate span').html(
start.format('MM-DD-YYYY') + ' - '+ end.format('YYYY-MM-DD'));
});/* $("#startdate").datetimepicker({
language : 'zh-CN',
format : "yyyy-mm-dd",
autoclose : true,
todayBtn : true,
pickerPosition : "bottom-left",
minView : 2 //最精准的时间选择为日期0-分 1-时 2-日 3-月
});
$("#enddate").datetimepicker({
language : 'zh-CN',
format : "yyyy-mm-dd",
autoclose : true,
todayBtn : true,
pickerPosition : "bottom-left",
minView : 2
}); */});</script>
Link: Password: 1bvq
The above is the detailed content of How to use time control in bootstrap. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

How to use Bootstrap to get the value of the search bar: Determines the ID or name of the search bar. Use JavaScript to get DOM elements. Gets the value of the element. Perform the required actions.

Using Bootstrap in Vue.js is divided into five steps: Install Bootstrap. Import Bootstrap in main.js. Use the Bootstrap component directly in the template. Optional: Custom style. Optional: Use plug-ins.

Use Bootstrap to implement vertical centering: flexbox method: Use the d-flex, justify-content-center, and align-items-center classes to place elements in the flexbox container. align-items-center class method: For browsers that do not support flexbox, use the align-items-center class, provided that the parent element has a defined height.

There are two ways to create a Bootstrap split line: using the tag, which creates a horizontal split line. Use the CSS border property to create custom style split lines.

There are several ways to insert images in Bootstrap: insert images directly, using the HTML img tag. With the Bootstrap image component, you can provide responsive images and more styles. Set the image size, use the img-fluid class to make the image adaptable. Set the border, using the img-bordered class. Set the rounded corners and use the img-rounded class. Set the shadow, use the shadow class. Resize and position the image, using CSS style. Using the background image, use the background-image CSS property.

To set up the Bootstrap framework, you need to follow these steps: 1. Reference the Bootstrap file via CDN; 2. Download and host the file on your own server; 3. Include the Bootstrap file in HTML; 4. Compile Sass/Less as needed; 5. Import a custom file (optional). Once setup is complete, you can use Bootstrap's grid systems, components, and styles to create responsive websites and applications.

How to use the Bootstrap button? Introduce Bootstrap CSS to create button elements and add Bootstrap button class to add button text

To adjust the size of elements in Bootstrap, you can use the dimension class, which includes: adjusting width: .col-, .w-, .mw-adjust height: .h-, .min-h-, .max-h-
