• datepicker格式化时间


    只选择年份:

    $("#txttYear").datepicker({
    changeMonth: false,
    changeYear: true,
    showButtonPanel: true,
    dateFormat: 'yy',
    onClose: function (dateText, inst) {
    var month = $("#ui-datepicker-div .ui-datepicker-month :selected").val();
    var year = $("#ui-datepicker-div .ui-datepicker-year :selected").val();
    $(this).datepicker('setDate', new Date(year,month,1));
    }
    });

    选择年月:

    $("#txtYearMonth").datepicker({
    changeMonth: false,
    changeYear: true,
    showButtonPanel: true,
    dateFormat: 'yymm',
    onClose: function (dateText, inst) {
    var month = $("#ui-datepicker-div .ui-datepicker-month :selected").val();
    var year = $("#ui-datepicker-div .ui-datepicker-year :selected").val();
    $(this).datepicker('setDate', new Date(year,month,1));
    }
    });

    选择年月日:

    $("#txtDate").datepicker({
    changeMonth: false,
    changeYear: true,
    showButtonPanel: true,
    dateFormat: 'yymmdd',
    onClose: function (dateText, inst) {
    var month = $("#ui-datepicker-div .ui-datepicker-month :selected").val();
    var year = $("#ui-datepicker-div .ui-datepicker-year :selected").val();
    $(this).datepicker('setDate', new Date(year, month, 1));
    }
    });

  • 相关阅读:
    c语言 9-3
    c语言 9-12
    c语言 9-11
    c语言 9-10
    c语言中实现字符串大小写的转换
    tyvj1106 登山
    tyvj1125 JR's chop
    tyvj1148 小船弯弯
    tyvj1087 sumsets
    tyvj1086 Elevator
  • 原文地址:https://www.cnblogs.com/josechuanmin/p/3086572.html
Copyright © 2020-2023  润新知