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

posted @ 2017-03-20 15:52  知兮  阅读(13092)  评论(0编辑  收藏  举报