let data = getMyDate(createTime); //(createTime /接口获取到的时间戳)
                    function getMyDate(str){
                        let oDate = new Date(str),
                            oYear = oDate.getFullYear(),
                            oMonth = oDate.getMonth()+1,
                            oDay = oDate.getDate(),
                            // oHour = oDate.getHours(), 时
                            // oMin = oDate.getMinutes(), 分
                            // oSen = oDate.getSeconds(), 秒
                            oTime = oYear +'-'+ getzf(oMonth) +'-'+ getzf(oDay);
                        return oTime;
                    }
                    function getzf(num){
                        if(parseInt(num) < 10){
                            num = '0'+num;
                        }
                        return num;
                    }

  

 

 

posted on 2019-07-30 14:20  carryH5  阅读(672)  评论(0编辑  收藏  举报