毫秒数转日期

//时间补零操作
            addZero(num){
                if(parseInt(num) < 10){
                    num = '0'+num;
                }
                return num;
            },
            // 修改日期格式
            timeFil(time) {
                let oDate = new Date(time);
                let oYear = oDate.getFullYear();
                let oMonth = oDate.getMonth()+1;
                let oDay = oDate.getDate();
                let oHour = oDate.getHours();
                let oMin = oDate.getMinutes();
//                let oSen = oDate.getSeconds();
                let oTime = oYear +'-'+ addZero(oMonth) +'-'+ addZero(oDay) +' '+ addZero(oHour) +':'+ addZero(oMin);
                return oTime;
            }

 

posted @ 2019-04-03 13:23  小白&小菜  阅读(1137)  评论(0编辑  收藏  举报
我是一个小菜鸟,飞呀飞呀,快飞高