datetimepicker[jquery-ui]時間控件的三種初始化方法


1.只顯示年月日

$( ".datepicker").datepicker({
        needDay:true,
        changeMonth: true, //顯示月份
        changeYear: true, //顯示年份
        showButtonPanel: true, //顯示按鈕
        dateFormat: 'yy-mm-dd', //日期格式
    });

2.只顯示時分秒(需要引入時間插件文件。1.【jQuery-Timepicker-Addon/jquery-ui-timepicker-addon.js】2.漢化【datetimepicker/js/jquery.ui.datepicker-zh-CN.js.js】)

 
         
$('.datepicker-times').timepicker({
         showButtonPanel: true, //顯示按鈕 timeFormat: "HH:mm:ss",  });
 

3.顯示年月日時分秒,

$('.datepicker-times').datetimepicker({
        needDay:true,
        changeMonth: true, //顯示月份
        changeYear: true, //顯示年份
        showButtonPanel: true, //顯示按鈕
        timeFormat: "HH:mm:ss",
        dateFormat: "yy-mm-dd"
    });

官網:http://trentrichardson.com/examples/timepicker/#tp-examples


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM