js 时间戳转换成hh:mm:dd:hh:mm:ss

//时间戳日期转换
        function getTime(time){
            console.log(time);
            var times ='';
            var date = new Date(time);
            Y = date.getFullYear() + '-';
            M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '-';
            D = date.getDate() + ' ';
            h = date.getHours() + ':';
            m = date.getMinutes() + ':';
            s = date.getSeconds();
            console.log(Y+M+D+h+m+s);
            times=Y+M+D+h+m+s;
            return times;
        }


你可能感兴趣的:(js 时间戳转换成hh:mm:dd:hh:mm:ss)