zoukankan      html  css  js  c++  java
  • JS 方法收集

    格式化json日期

    dt.format("yyyy-MM-dd hh:mm:ss"); //这里用到一个javascript的Date类型的拓展方法,这个是自己添加的拓展方法,在后面的步骤3定义
    
     //3.为原始Date类型拓展format一个方法,用于日期显示的格式化
                    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;
                    }
  • 相关阅读:
    22_selenium_使用cookie直接登录
    21_无头模式
    自动化测试-设计模式-介绍
    Doorls
    pytest-Allure报告
    pytest-架构1
    pytest-第一次学习梳理
    web测试
    测试-工时评估
    封装pyuic5转换ui文件的脚本
  • 原文地址:https://www.cnblogs.com/FH-cnblogs/p/3865469.html
Copyright © 2011-2022 走看看