zoukankan      html  css  js  c++  java
  • json时间格式化

    function ChangeDateFormat(jsondate) {
        jsondate = jsondate.replace("/Date(", "").replace(")/", "");
        if (jsondate.indexOf("+") > 0) {
            jsondate = jsondate.substring(0, jsondate.indexOf("+"));
        }
        else if (jsondate.indexOf("-") > 0) {
            jsondate = jsondate.substring(0, jsondate.indexOf("-"));
        }
    
        var date = new Date(parseInt(jsondate, 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
            + "日"
            + " "
            + date.getHours()
            + ":"
            + date.getMinutes();
    }

       转自张占龄

  • 相关阅读:
    clean code
    jenkins
    获取目录下的文件名称
    bootstrap-select 下拉互斥
    supervisord
    正则表达式
    Docker
    git
    goland工具
    小程序 swiper 轮播图滚动图片 + 视频
  • 原文地址:https://www.cnblogs.com/Evaniko/p/5389911.html
Copyright © 2011-2022 走看看