Bootstrap-datetimepicker implements methods that show only the date _javascript tips

Source: Internet
Author: User
Tags time and date

The example in this article describes the method that the Bootstrap-datetimepicker implementation displays only to dates. Share to everyone for your reference, specific as follows:

Bootstrap-datetimepicker is usually set to the time and minutes, sometimes do not need, how to deal with it?

Minview: "Month",//select date, will not jump to select seconds

1. Introducing

<link href= "Public/css/bootstrap.min.css" type= "Text/css" rel= "stylesheet" >
<script type= "text/" JavaScript "src=" {sh::P ub}js/jquery-1.10.2.min.js "></script>
<link type=" Text/css "rel=" Stylesheet "href=" {sh::P ub}css/bootstrap-datetimepicker.min.css ">
<script src=" {sh::P ub}js/ Bootstrap-datetimepicker.min.js "type=" Text/javascript "/></script>
<script src=" {sh::P ub}js/ Bootstrap-datetimepicker.zh-cn.js "type=" Text/javascript "/></script>

2. Configure

Calendar
$ ('. Form_datetime '). DateTimePicker ({
  minview: "Month",///Select date, will not jump to choose time seconds
  language: ' ZH-CN ',
  format: ' Yyyy-mm-dd ',
  todaybtn:1,
  autoclose:1,
});

3.html

<div class= "Form-group row" >
  <div class= "left col-xs-3 text-right" >
    <label for= "" >* Time: </label>
  </div>
  <div class= "right col-xs-6 text-left" >
    <div class= "Input-group ">
     <input type=" text "class=" Form-control form_datetime "id=" Addtime "name=" Addtime "value=" {sh:$ info.addtime|default= $time |date= ' y-m-d ', ###} "placeholder=" ">
     <span class=" Input-group-addon "id=" Basic-addon2 "><span class= glyphicon glyphicon-time" aria-hidden= "true" ></span></span>
    </div>
  </div>
</div>

More readers interested in JavaScript-related content can view the site topics: "JavaScript time and date Operation skills Summary", "JavaScript data structure and algorithm skills summary", "JavaScript switching effects and techniques summary", " JavaScript Search Algorithm Tips summary, JavaScript animation effects and techniques summary, JavaScript error and debugging skills Summary, JavaScript traversal algorithm and techniques summary and JavaScript mathematical Operational Usage Summary

I hope this article will help you with JavaScript programming.

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.