JS Date Time Picker

Source: Internet
Author: User


This article describes the use of a date and time selector. This selector is implemented by the jQueryUI, which supports time selection up to milliseconds.

This selector project address is http://trentrichardson.com/examples/timepicker/

The demo address is: http://www.helloweba.com/demo/timepicker/

: http://download.csdn.net/detail/yanwushu/7721933


In addition, the JS time Picker can also refer to other projects

http://www.bootcss.com/p/bootstrap-datetimepicker/

http://guangqiang.iteye.com/blog/1559262


General use steps

This control is very simple to use, just introduce JS and CSS, and then add a jquery code.


Introduction of JS Library

<scripttype= "Text/javascript" src= ". /commons/datetimepicker/js/jquery-1.7.2.min.js "></script>

<scripttype= "Text/javascript" src= ". /commons/datetimepicker/js/jquery-ui.js "></script>

<scripttype= "Text/javascript" src= ". /commons/datetimepicker/js/jquery-ui-slide.min.js "></script>

<script type= "Text/javascript" src= ". /commons/datetimepicker/js/jquery-ui-timepicker-addon.js "></script>


Introduce styles

<link rel= "stylesheet" type= "Text/css" href= "Css/jquery-ui.css"/>

<script type= "Text/javascript" src= "Js/jquery.min.js" ></script>

<script type= "Text/javascript" src= "Js/jquery-ui.js" ></script>

<script type= "Text/javascript" src= "Js/jquery-ui-timepicker-addon.js" ></script>

In addition to the style that introduces the jquery UI, you need to add the following styles to control the appearance of the time control.

. ui-timepicker-div. ui-widget-header {margin-bottom:8px;}

. ui-timepicker-div dl {text-align:left;}

. ui-timepicker-div DL DT {height:25px; Margin-bottom: -25px;}

. Ui-timepicker-div DL DD {margin:0 10px 10px 65px;}

. ui-timepicker-div td {font-size:90%;}

. ui-tpicker-grid-label {background:none; border:none; margin:0; padding:0;}

. Ui_tpicker_hour_label,.ui_tpicker_minute_label,.ui_tpicker_second_label,

. ui_tpicker_millisec_label,.ui_tpicker_time_label{padding-left:20px}


Initializing the control
< Input type= "text"  id= "Example" &NBSP;/>&NBSP;

$ (' #example_1 '). DateTimePicker ();  

If you only need to display the time:

$ (' #example_2 '). Timepicker ();  

Define time Format:

$ (' #example_3 '). DateTimePicker ({ 

Span style= "COLOR: #365F91" >&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;SHOWSECOND:&NBSP;TRUE,&NBSP;

&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;SHOWMILLISEC:&NBSP;TRUE,&NBSP;

     timeformat:  ' hh:mm:ss:l '  

})  

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.