教程:datetimepicker日期时间插件

1、默认:

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

2、只选择时间:

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

3、显示时分秒毫秒格式:

   $('#example_3').datetimepicker({
	   showSecond: true,
	   showMillisec: true,
	   timeFormat: 'hh:mm:ss:l'
   });
                    

4、设置时间可选范围:

   $('#example_4').timepicker({
	   ampm: true,
	   hourMin: 8,
	   hourMax: 16
   });
                    

5、默认时间:

   $('#example_5').datetimepicker({
	   hour: 13,
	   minute: 15
   });
                    

6、显示多月并设置可选日期范围:

   $('#example_6').datetimepicker({
	   numberOfMonths: 2,
	   minDate: 0,
	   maxDate: 30
   });
                    

7、显示时间标尺:

   $('#example_7').timepicker({
	   hourGrid: 4,
	   minuteGrid: 10
   });
                    

8、获取和设置时间:

      var ex8 = $('#example_8');

      ex8.datetimepicker();

      $('#example_8_set_btn').click(function(){
	      ex8.datetimepicker('setDate', (new Date()) );
      });

      $('#example_8_get_btn').click(function(){
	       alert(ex8.datetimepicker('getDate'));
      });
                        
Powered by erdangjiade.com 本站皆为作者原创,转载请注明原文链接:www.erdangjiade.com