zoukankan      html  css  js  c++  java
  • JQuery datepicker

    为 $("#ReceivedDate").datepicker(); 添加 time:

    解决办法:

     自定义一个函数:

      

    function formatDateWithHHmm(current) {
        if (/^d{1,2}/d{1,2}/d{4}$/.test(current)) {
            var date = new Date();
            var hh = date.getHours() < 10 ? '0' + date.getHours() : date.getHours();
            var mm = date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes();
            return current + ' ' + hh + ':' + mm;
        }
        return current;
    }

     $("#ReceivedDate").datepicker();  //format: M/d/yyyy

    $('#ReceivedDate').change(function () {
        $('#ReceivedDate').val(formatDateWithHHmm($('#ReceivedDate').val()));  //最终取值:M/d/yyyy HH:mm
    });

  • 相关阅读:
    基于http实现网络yum源搭建
    基于长轮询简易版聊天室
    放大镜案例
    弹出登录框
    拖拽案例
    js入门之DOM动态创建数据
    heoi2020游记
    省选模拟6&7
    省选模拟5
    后缀自动机总结
  • 原文地址:https://www.cnblogs.com/yipeng-yu/p/4991424.html
Copyright © 2011-2022 走看看