其他分享
首页 > 其他分享> > js时间戳转换时间

js时间戳转换时间

作者:互联网

 /*时间戳转换成-年月日时分秒*/
            formatDateTime (inputTime) {
                var date = new Date(inputTime);
                var y = date.getFullYear();
                var m = date.getMonth() + 1;
                m = m < 10 ? ('0' + m) : m;
                var d = date.getDate();
                d = d < 10 ? ('0' + d) : d;
                var h = date.getHours();
                h = h < 10 ? ('0' + h) : h;
                var minute = date.getMinutes();
                var second = date.getSeconds();
                minute = minute < 10 ? ('0' + minute) : minute;
                second = second < 10 ? ('0' + second) : second;
                return y + '-' + m + '-' + d + ' ' + h + ':' + minute + ':' + second;
            },

标签:10,转换,inputTime,js,date,second,时间,var,minute
来源: https://blog.csdn.net/qq_41820986/article/details/119384980