被Json格式化后那可怜的时间

复制代码

  function renderTime(date) {
            var da = new Date(parseInt(date.replace("/Date(", "").replace(")/", "").split("+")[0]));
            Year = da.getFullYear(); //ie火狐下都可以
            Month = da.getMonth() + 1;
            Day = da.getDate();

            var CurrentDate = "";
            CurrentDate += Year + "-";
            if (Month >= 10) {
                CurrentDate += Month + "-";
            }
            else {
                CurrentDate += "0" + Month + "-";
            }
            if (Day >= 10) {
                CurrentDate += Day;
            }
            else {
                CurrentDate += "0" + Day;
            }
            return CurrentDate + " " + da.getHours() + ":" + da.getSeconds() + ":" + da.getMinutes();
        }
复制代码
posted @ 2015-11-20 17:10  大楚打码人  阅读(236)  评论(0编辑  收藏  举报