How to use bootstrap to implement a time selector for year, month and day

爱喝马黛茶的安东尼
Release: 2019-07-17 13:05:58
Original
7125 people have browsed it

How to use bootstrap to implement a time selector for year, month and day

Using bootstrap to implement time selection, the page needs to load the following files:

1. CSS files: bootstrap.min.css, bootstrap-datetimepicker.min.css

2. JS files: jquery-1.8.3.min.js, bootstrap.min.js, bootstrap-datetimepicker.js, bootstrap-datetimepicker.zh-CN.js

How to use bootstrap to implement a time selector for year, month and day

Use bootstrap to implement year selection

The bootstrap configuration code is as follows:

<script type="text/javascript">
$(&#39;.form_datetime&#39;).datetimepicker({
    language:  &#39;zh-CN&#39;,
    minView: 4,         format: &#39;yyyy&#39;,
    startDate:2019,
    autoclose: 1,
    startView: 4,
});
</script>
Copy after login

The effect achieved is as follows:

How to use bootstrap to implement a time selector for year, month and day

Use bootstrap to implement month selection

The bootstrap configuration code is as follows:

<script type="text/javascript">
$(&#39;.form_datetime&#39;).datetimepicker({
    format: &#39;mm&#39;,
    autoclose:true,
    startView:3,
    minView:3,
    maxView:3,
    initialDate:new Date(),
    language:&#39;zh-CN&#39;
});
</script>
Copy after login
Copy after login

The effect achieved is as follows:

How to use bootstrap to implement a time selector for year, month and day

Related recommendations: "Bootstrap Getting Started Tutorial"

Use bootstrap to select the year and month

The bootstrap configuration code is as follows:

<script type="text/javascript">
$(&#39;.form_datetime&#39;).datetimepicker({
    format: &#39;mm&#39;,
    autoclose:true,
    startView:3,
    minView:3,
    maxView:3,
    initialDate:new Date(),
    language:&#39;zh-CN&#39;
});
</script>
Copy after login
Copy after login

The effect achieved is as follows:

How to use bootstrap to implement a time selector for year, month and day

Use bootstrap to select the year, month and day

The bootstrap configuration code is as follows :

<script type="text/javascript">
$(&#39;.form_datetime&#39;).datetimepicker({
     format: &#39;yyyymmdd&#39;,
     weekStart: 1,
     autoclose: true,
     startView: 2,
     minView: 2,
    language:&#39;zh-CN&#39;
});
</script>
Copy after login

The effect achieved is as follows:

How to use bootstrap to implement a time selector for year, month and day

Use bootstrap to select the year, month, day, hour, minute and second

The bootstrap configuration code is as follows:

<script type="text/javascript">
$(&#39;.form_datetime&#39;).datetimepicker({
         language : &#39;zh-CN&#39;,
         format : &#39;yyyy-mm-dd hh:ii:ss&#39;,
         weekStart: 1,
         todayBtn:  1,
         autoclose: 1,
         todayHighlight: 1,
         startView: 2,
         forceParse: 0,
         showMeridian: 1
});
</script>
Copy after login

The effect achieved is as follows:

How to use bootstrap to implement a time selector for year, month and day

Use bootstrap to implement hour selection

The bootstrap configuration code is as follows:

<script type="text/javascript">
$(&#39;.form_datetime&#39;).datetimepicker({
        language : &#39;zh-CN&#39;,
        weekStart: 1,
        todayBtn:  1,
        autoclose: 1,
        todayHighlight: 1,
        startView: 1,
        minView: 0,
        maxView: 1,
        forceParse: 0
});
</script>
Copy after login

The effect achieved is as follows:

How to use bootstrap to implement a time selector for year, month and day

The above is the detailed content of How to use bootstrap to implement a time selector for year, month and day. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!