zoukankan      html  css  js  c++  java
  • js 日期处理,json处理

    模块化js :requirejs
    http://www.requirejs.cn/

    好用的日期控件:
    http://www.bootcss.com/p/bootstrap-datetimepicker/index.htm




    //
    日期处理 //js 日期格式化通用方法 Date.prototype.format = function(format){ var o = { "M+" : this.getMonth()+1, //month "d+" : this.getDate(), //day "h+" : this.getHours(), //hour "m+" : this.getMinutes(), //minute "s+" : this.getSeconds(), //second "q+" : Math.floor((this.getMonth()+3)/3), //quarter "S" : this.getMilliseconds() //millisecond } if(/(y+)/.test(format)) { format = format.replace(RegExp.$1, (this.getFullYear()+"").substr(4 - RegExp.$1.length)); } for(var k in o) { if(new RegExp("("+ k +")").test(format)) { format = format.replace(RegExp.$1, RegExp.$1.length==1 ? o[k] : ("00"+ o[k]).substr((""+ o[k]).length)); } } return format; } var now = new Date(); // js 日期处理 var nowadd = now.setFullYear(now.getFullYear()+2); var d2=new Date(nowadd) var nowStr = d2.format("yyyy-MM-dd"); $('#userTime').val(nowStr);
    //表单标准化成json
    
    function standJsonByObj(obj){
    
        var o = {};
        var a = $(obj).serializeArray();
        $.each(a, function() {
            if (o[this.name] !== undefined) {
                if (!o[this.name].push) {
                    o[this.name] = [o[this.name]];
                }
                o[this.name].push(this.value || '');
            } else {
                o[this.name] = this.value || '';
            }
        });
        return o;
        };
  • 相关阅读:
    基于Token的WEB后台认证机制
    导出和导入Docker容器
    进入Docker容器
    介绍Docker容器
    Docker镜像的实现原理
    Docker 移除镜像
    存出和载入Docker镜像
    Docker 创建镜像
    Docker 列出镜像
    Docker如何获取镜像
  • 原文地址:https://www.cnblogs.com/8899man/p/5282239.html
Copyright © 2011-2022 走看看