• EasyUI时间格式化


    changeDateFormatNodate: function (cellval) {
    var date = new Date(parseInt(cellval.replace("/Date(", "").replace(")/", ""), 10));

    var hour = date.getHours() < 10 ? "0" + date.getHours() : date.getHours();
    var minute = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
    var second = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
    return hour + ":" + minute + ":" + second;
    },
    //将序列化成json格式后日期(毫秒数)转成日期格式
    changeDateFormat: function (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();
    var hour = date.getHours() < 10 ? "0" + date.getHours() : date.getHours();
    var minute = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
    var second = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
    return date.getFullYear() + "/" + month + "/" + currentDate + " " + hour + ":" + minute + ":" + second;
    },

    //将序列化成json格式后日期(毫秒数)转成日期格式
    changeDateFormatNoHMS: function (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;
    },

  • 相关阅读:
    《软件工程》-第三章随笔
    《软件工程》-第二章随笔
    《软件工程》-第一章随笔
    软件工程——理论、方法与实践③
    软件工程——理论、方法与实践②
    软件工程——理论、方法与实践①
    爬虫之SCRAPY
    爬虫之 App 爬取
    flask bootstrap
    爬虫之协程,selenium
  • 原文地址:https://www.cnblogs.com/115FXC/p/4093757.html
Copyright © 2020-2023  润新知