zoukankan      html  css  js  c++  java
  • 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;
    },

  • 相关阅读:
    [Re] Spring-4(SourceCode)
    [Re] Spring-3(JdbcTemplate)
    [Re] Spring-2(IOC+AOP)
    [Re] Spring-1(bean)
    08-MyBatis(2)
    08-传输层(7)
    07-传输层(6)
    06-传输层(5)
    05-传输层(4)
    ALS推荐算法
  • 原文地址:https://www.cnblogs.com/115FXC/p/4093757.html
Copyright © 2011-2022 走看看