• 将序列化成json格式后日期(毫秒数)转成日期格式


    //使用浏览器兼容的方式创建 异步对象
    function createXhr() {
    var xhobj = false;
    try {
    xhobj = new ActiveXObject("Msxml2.XMLHTTP"); // ie msxml3.0+
    } catch (e) {
    try {
    xhobj = new ActiveXObject("Microsoft.XMLHTTP"); //ie msxml2.6
    } catch (e2) {
    xhobj = false;
    }
    }
    if (!xhobj && typeof XMLHttpRequest != 'undefined') {// Firefox, Opera 8.0+, Safari
    xhobj = new XMLHttpRequest();
    }
    return xhobj;
    }
    //将序列化成json格式后日期(毫秒数)转成日期格式
    function changeDateFormat(cellval) {
    var date = new Date(parseInt(cellval.replace("/Date(", "").replace(")/", ""), 10));
    var month = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
    var currentDate
    = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
    return date.getFullYear() + "-" + month + "-" + currentDate;
    }
  • 相关阅读:
    SEO搜索引擎
    SEO
    编程的智慧
    ES6编程规范
    面试题集
    motto
    motto
    JS
    motto
    Linux
  • 原文地址:https://www.cnblogs.com/gylspx/p/11dsa.html
Copyright © 2020-2023  润新知