美文网首页
js 时间戳转换成hh:mm:dd:hh:mm:ss

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

作者: Symbian米汤 | 来源:发表于2018-07-03 15:59 被阅读0次
//时间戳日期转换
        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

      本文链接:https://www.haomeiwen.com/subject/quqjuftx.html