Bootstrap ~ Date control and bootstrap date Control

Source: Internet
Author: User

Bootstrap ~ Date control and bootstrap date Control

Back to directory

A mature framework, date control is indispensable. There are also many date control options available on the Internet, while the main framework uses bootstrap, date control also uses its own,

Control Address: http://www.bootcss.com/p/bootstrap-datetimepicker/index.htm

GitHub Open Source Address: https://github.com/smalot/bootstrap-datetimepicker

Before using datetimepicker, follow these steps:

1 Reference JS script Library

<script src="/Content/bootstraps/js/bootstrap.js"></script><script src="/Content/bootstraps/js/bootstrap-datetimepicker.js"></script><script src="/Content/bootstraps/js/bootstrap-datetimepicker.zh-CN.js"></script>

The bootstrap-datetimepicker.zh-CN.js indicates that the date and time can be displayed in a Chinese language

2. Introduce the CSS class library

<link href="/Content/bootstraps/css/bootstrap.css" rel="stylesheet"/><link href="/Content/bootstraps/css/bootstrap-datetimepicker.css" rel="stylesheet"/>

3. Define HTML tags

<input class="form_datetime form-control" type="text" value="2016-03-07" size="16">

4. Compile a datetimepicker event

<Script type = "text/javascript"> $ (". form_datetime "). datetimepicker ({format: "yyyy-mm-dd", autoclose: true, todayBtn: true, todayHighlight: true, showMeridian: true, pickerPosition: "bottom-left", language: 'zh-cn', // Chinese, need to reference zh-CN.js package startView: 2, // monthly view minView: 2 // the most accurate time selection view provided by the date and time selector}); </script>

Note: many friends have asked online how to use only the date or no time, because by default, every time you use datetimepicker to select the day level, very Uncomfortable. Uncle developed in his research and used the minView parameter to solve this problem. It is equivalent to the minimum display accuracy in control,

0 indicates the minute (default), 1 indicates the hour, and 2 indicates the day. If we set the value to 2, the page for selecting the hour will no longer appear!

Back to directory

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.