zoukankan      html  css  js  c++  java
  • js日期格式转化

    如果出现日期格式:

    /Date(1442742059253)/

    可用下面js方法转化

       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();
            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;
        }

  • 相关阅读:
    hw4 打卡
    lab4打卡
    hw3打卡
    lab3打卡
    hw2打卡
    lab2打卡
    hw1打卡
    Java Trie(词典树)实现
    Java HashMap实现
    DFS习题复习(2) DFS的实际应用:括号检测,graph Bipartite及随机生成迷宫
  • 原文地址:https://www.cnblogs.com/xbblogs/p/4837479.html
Copyright © 2011-2022 走看看